2 Replies Latest reply on Sep 24, 2013 6:07 AM by Leonardo Landini

    Clustered MDB connection to a clustered topic

    Leonardo Landini Newbie

      Hi all, after reading a lot of discussion and trying a lot of example code with no success I'm starting this new thread. I have a j2ee application running in a clustered environment (jboss eap 6.1, 2 nodes, standalone configuration) and my application needs to connect to a clustered jms topic to consume messages. Obviously I want the messages to be delivered once, to any of my MDBs.

       

      The problem with my setup is that both MDBs try to connect to the topic, the first succeeds and the other fails because of the duplicate subscriber ID. If I kill the first node the second MDB promptly connects to the topic, and if I restart the first node now the first MDB fails for the same reason. So I can have only 1 MDB connected at a time, with the other filling the log with error messages.

       

      I thought 2 MDB in a clustered container should act as a single instance for an external topic (even if the topic is clustered too). Am I missing something ? Can someone help me find the error in my configuration ?

       

      Thanks a lot

       

      Leonardo

       

      Below my client application config (mdb and hornetq server)

       

      MDB:

       

      @MessageDriven(mappedName = "jms/SEOManager",

                     activationConfig = {

                        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),

                        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),

                        @ActivationConfigProperty(propertyName = "clientId", propertyValue = "my-client-id"),

                        @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/topictest"),

                        @ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "my-client-id"),

                        @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue="Durable"),

                        @ActivationConfigProperty(propertyName = "hA", propertyValue = "true")

      ...

       

      HornetQ config (inside jboss standalone-full-ha.xml) where messaging-group is the client application multicast address socket, server-messaging-group is the server multicast address socket. The MDB is configured to use the "hornetq-ra" pooled connection factory.

       

      <subsystem xmlns="urn:jboss:domain:messaging:1.3">

                  <hornetq-server>

                      <clustered>true</clustered>

                      <security-enabled>false</security-enabled>

                      <persistence-enabled>true</persistence-enabled>

                      <journal-file-size>102400</journal-file-size>

                      <journal-min-files>2</journal-min-files>

       

                      <connectors>

                          <netty-connector name="netty" socket-binding="messaging"/>

                          <netty-connector name="netty-throughput" socket-binding="messaging-throughput">

                              <param key="batch-delay" value="50"/>

                          </netty-connector>

                          <in-vm-connector name="in-vm" server-id="0"/>

                      </connectors>

       

                      <acceptors>

                          <netty-acceptor name="netty" socket-binding="messaging"/>

                          <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">

                              <param key="batch-delay" value="50"/>

                              <param key="direct-deliver" value="false"/>

                          </netty-acceptor>

                          <in-vm-acceptor name="in-vm" server-id="0"/>

                      </acceptors>

       

                      <broadcast-groups>

                          <broadcast-group name="my-bg">

                              <socket-binding>messaging-group</socket-binding>

                              <broadcast-period>5000</broadcast-period>

                              <connector-ref>netty</connector-ref>

                          </broadcast-group>

                          <broadcast-group name="server-bg">

                              <socket-binding>server-messaging-group</socket-binding>

                              <broadcast-period>1000</broadcast-period>

                              <connector-ref>netty</connector-ref>

                          </broadcast-group>

                      </broadcast-groups>

                      <discovery-groups>

                          <discovery-group name="my-dg">

                              <socket-binding>messaging-group</socket-binding>

                              <refresh-timeout>10000</refresh-timeout>

                          </discovery-group>

                          <discovery-group name="server-dg">

                              <socket-binding>server-messaging-group</socket-binding>

                              <refresh-timeout>10000</refresh-timeout>

                          </discovery-group>

                      </discovery-groups>

       

                      <cluster-connections>

                          <cluster-connection name="my-jms-cluster">

                              <address>jms</address>

                              <use-duplicate-detection>true</use-duplicate-detection>

                              <discovery-group-ref discovery-group-name="my-dg"/>

                              <connector-ref>netty</connector-ref>

                          </cluster-connection>

                      </cluster-connections>

       

                      <security-settings>

                          <security-setting match="#">

                              <permission type="send" roles="guest"/>

                              <permission type="consume" roles="guest"/>

                              <permission type="createDurableQueue" roles="guest"/>

                              <permission type="createNonDurableQueue" roles="guest"/>

                              <permission type="deleteNonDurableQueue" roles="guest"/>

                          </security-setting>

                      </security-settings>

       

                      <address-settings>

                          <address-setting match="#">

                              <dead-letter-address>jms.queue.DLQ</dead-letter-address>

                              <expiry-address>jms.queue.ExpiryQueue</expiry-address>

                              <redelivery-delay>0</redelivery-delay>

                              <max-size-bytes>10485760</max-size-bytes>

                              <address-full-policy>BLOCK</address-full-policy>

                              <message-counter-history-day-limit>10</message-counter-history-day-limit>

                          </address-setting>

                      </address-settings>

       

                      <jms-connection-factories>

                          <connection-factory name="InVmConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="in-vm"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/ConnectionFactory"/>

                              </entries>

                          </connection-factory>

                          <connection-factory name="RemoteConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="netty"/>

                              </connectors>

                              <entries>

                                  <entry name="RemoteConnectionFactory"/>

                                  <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>

                              </entries>

                          </connection-factory>

                          <pooled-connection-factory name="hornetq-ra">

                              <ha>true</ha>

                              <transaction mode="xa"/>

                              <discovery-group-ref discovery-group-name="server-dg"/>

                              <entries>

                                  <entry name="java:/JmsXA"/>

                              </entries>

                          </pooled-connection-factory>

                      </jms-connection-factories>

                  </hornetq-server>

              </subsystem>