JBoss 7.4.4: Deploy applications after queues creation

72 views Asked by At

I'm trying to update some applications of our company from a server with JBoss 6.3.3 to a server running JBoss 7.4.4.

Everything looks fine. The only problem is that my application is trying to use the JNDI object java:/ConnectionFactory before it is created. This makes the application fail. After the application error (some time later) I am able to see into the logs that the queues are correctly bounded to the Jndi objects:

2023-07-04 10:21:59,782 INFO  [org.wildfly.extension.messaging-activemq] (ServerService Thread Pool -- 84) WFLYMSGAMQ0002: Bound messaging object to jndi name java:/ConnectionFactory

I tried managing it at source code side but it generates side effects (new errors during start up and the need of supporting an specific branch of a custom library for this client).

The queue was defined in JBoss 6.3.3 in this way:

        <subsystem xmlns="urn:jboss:domain:messaging:1.4">
            <hornetq-server>
                ...
                <jms-connection-factories>
                    <connection-factory name="InVmConnectionFactory">
                        <connectors>
                            <connector-ref connector-name="in-vm"/>
                        </connectors>
                        <entries>
                            <entry name="java:/ConnectionFactory"/>
                        </entries>
                    </connection-factory>
                ...
                <jms-connection-factories>
                ...
            </hornetq-server>
        </subsystem>

But HornetQ is deprecated. In Jboss 7.4.4 the queue is defined in the messaging-activemq subsystem, in this way:

<subsystem xmlns="urn:jboss:domain:messaging-activemq:13.0">
  <server name="default" persistence-enabled="false">
      .....
    <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
      ......
  </server>
</subsystem>

It seems that messaging-activemq is a bit slower on starting up and queue generation that HornetQ.

In previous versions, when we had this error, we managed it using the jboss-dependency.xml file:

<dependency xmlns="urn:jboss:dependency:1.0">
    <item whenRequired="Real" dependentState="Create">org.hornetq:module=JMS,name="InVMConnectionFactory",type=ConnectionFactory</item>
</dependency>

But this is deprecated on JBoss 7.4.4

I have tried jboss-all.xml file, jboss-deployment-dependencies.xml file, and creating custom modules, but I'm not able to fix it.

What I need is that JBoss deploy my applications after that queue is created and the JNDI object (java:/ConnectionFactory) is bound to that queue. I checked the documentation, but I didn't seen anything.

How can I do it?

The JNDI object is looked up using javax.naming.Context, e.g.:

Context ctx = new Context();
ConnectionFactory cf = ctx.lookup("java:/ConnectionFactory");

Into the jboss-all.xml I tried adding the dependencies using this format:

<jboss xmlns="urn:jboss:1.0">
    <jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
        <dependency name="DEPENDENCY" />
    </jboss-deployment-dependencies>
</jboss> 

Instead of DEPENDENCY I tried:

  • org.wildfly.messaging.jms.queue.InVmConnectionFactory
  • InVmConnectionFactory
  • java:/ConnectionFactory
  • org.wildfly.extension.messaging-activemq
  • The name of my custom modules
  • Other random stuff when I didn't know what more trying.

Into the jboss-deployment-dependencies I tried adding the dependencies using this format:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <dependencies>
            <resource-root path="DEPENDENCY" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

Where DEPENDENCY was:

  • org.wildfly.messaging.jms.queue.InVmConnectionFactory
  • InVmConnectionFactory
  • java:/ConnectionFactory

Also I tried removing the resource-root node and adding:

<module name="org.wildfly.extension.messaging-activemq" />

But I have had no success.


UPDATE: It looks like they have removed the possibility of adding jboss dependencies on queues and it should be controlled at source code level.

0

There are 0 answers