5 Replies Latest reply on Nov 25, 2013 6:57 AM by igarashitm

    Adding a dependency on HornetQ RAR deployment

    igarashitm

      Hi,

       

      Could anybody let me know how can I wait for HornetQ RAR deployment on AS7?

       

      Our SwitchYard JCA integration acquires the ResourceAdapter instance from ResourceAdapterRepository, so the RAR should have been deployed before the SwitchYard JCA application. Adding a dependency on RAR deployment with jboss-deployment-structure.xml should work in most cases. However, it didn't work for HornetQ even if I added a dependency on deployment.hornetq-ra. Is there any way to depend on HornetQ RAR deployment on AS7?

       

      Thanks,

      Tomo

        • 1. Re: Adding a dependency on HornetQ RAR deployment
          jbertram

          Try setting your dependency on "jboss.ra.hornetq-ra" and let me know if that works.

          • 2. Re: Re: Adding a dependency on HornetQ RAR deployment
            igarashitm

            Thanks for the idea Justin, but no luck... apparently it's looking for the module.

            Caused by: org.jboss.modules.ModuleNotFoundException: jboss.ra.hornetq-ra:main
              at org.jboss.modules.Module.addPaths(Module.java:949) [jboss-modules.jar:1.2.0.Final-redhat-1]
              at org.jboss.modules.Module.link(Module.java:1304) [jboss-modules.jar:1.2.0.Final-redhat-1]
              at org.jboss.modules.Module.relinkIfNecessary(Module.java:1332) [jboss-modules.jar:1.2.0.Final-redhat-1]
              at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:226) [jboss-modules.jar:1.2.0.Final-redhat-1]
              at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:71) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
              ... 5 more
            

             

            "deployment." prefix is obviously working as a magic word, but just doesn't work for HornetQ built-in RAR.

            • 3. Re: Adding a dependency on HornetQ RAR deployment
              igarashitm

              Anyone has any idea? Sounds like the only way to do this is adding subsystem dependency in the code... I'd really like to avoid it if I can....

              • 4. Re: Re: Adding a dependency on HornetQ RAR deployment
                synclpz

                I fixed via dumb way:


                1. Made a web-application with ServletContextListener which tries to lookup for java:/JmsXA in a loop until it is available (actually after HornetQ startup)

                2. Add a jboss-all.xml dependencies to all other deployments so they depend on my webapp deployment

                3. Profit!!!111


                Could not attach files, so the sources inlined:

                 

                @WebListener
                public class StartupListener implements ServletContextListener {
                
                
                  private static final Logger LOGGER = LoggerFactory
                  .getLogger(StartupListener.class);
                
                
                  public void contextInitialized(ServletContextEvent event) {
                  InitialContext ctx;
                  try {
                  ctx = new InitialContext();
                  } catch (Throwable t) {
                  throw new RuntimeException(t);
                  }
                  Object jmsXA = null;
                  while (true) {
                  try {
                  jmsXA = ctx.lookup("java:/JmsXA");
                  if (jmsXA != null) {
                  LOGGER.info("JmsXA found to be started");
                  break;
                  }
                  Thread.sleep(1000);
                  } catch (Exception e) {
                  LOGGER.info("Waiting for JmsXA to start...");
                  LOGGER.trace("Exception looking up JmsXA", e);
                  try {
                  Thread.sleep(1000);
                  } catch (InterruptedException e1) {
                  LOGGER.warn("Interrupted waiting for JmsXA to start");
                  }
                  }
                  }
                  }
                
                
                  public void contextDestroyed(ServletContextEvent event) {
                  // nothing
                  }
                }
                



                • 5. Re: Re: Adding a dependency on HornetQ RAR deployment
                  igarashitm

                  Just FYI - Since I couldn't find any way to do this except polling, decided to let the AS7 deployment processor handle it.

                  [SWITCHYARD-1789] JCAActivator should wait for the HornetQ RAR deployment - JBoss Issue Tracker

                   

                  Now SwitchYard JCA gateway always waits for the RAR initialization including HornetQ built-in RAR. You don't have to do anything after SwitchYard 1.1.