12 Replies Latest reply on Apr 26, 2012 5:50 AM by gfeuede

    Multiple delivery to a MDB on a (clustered) topic

    gfeuede Newbie

      Hi,

       

      I have a clustered setup with a topic. When I put a message in that topic, it will be delivered to all nodes in that cluster. The only problem is, that on every node the message will be delivered twice. The JMS message ID are the same, so where can I find the error? The cluster setup is more or less the default one and I dont think, the error will be there. In the debug log is this:

       

      (Thread-51 (HornetQ-client-global-threads-6321908)) +++ message arrived [ID:f83e3864-8d51-11e1-bcc1-080027ae36fe]

      (Thread-47 (HornetQ-client-global-threads-6321908)) +++ message arrived [ID:f83e3864-8d51-11e1-bcc1-080027ae36fe]

       

      The same message go to two threads. The MDB annotations are this:

       

      @MessageDriven(

              activationConfig = {

                      @ActivationConfigProperty(

                              propertyName = "acknowledgeMode",

                              propertyValue = "Auto-acknowledge"

                      ),

                      @ActivationConfigProperty(

                              propertyName = "destinationType",

                              propertyValue = "javax.jms.Topic"

                      ),

                      @ActivationConfigProperty(

                              propertyName = "destination",

                              propertyValue = "java:jboss/exported/jms/topic/deliveryTopic"

                      )

              }

      )

       

      Does anyone have a hint for me, what is wrong?

       

             Thanks!

        • 1. Re: Multiple delivery to a MDB on a (clustered) topic
          jaikiran pai Master

          Which exact version of AS7 is this?

          • 2. Re: Multiple delivery to a MDB on a (clustered) topic
            gfeuede Newbie

            JBoss identify itself as »JBoss AS 7.1.1.Final "Brontes"« on the console while startup. I use the JMS provider which are embedded in JBoss (HornetQ Server version 2.2.13.Final (HQ_2_2_13_FINAL_AS7, 122)) ...

            • 3. Re: Multiple delivery to a MDB on a (clustered) topic
              jaikiran pai Master

              Can you try this against the latest nightly build available here https://community.jboss.org/thread/167590

              • 4. Re: Multiple delivery to a MDB on a (clustered) topic
                gfeuede Newbie

                Hi,

                 

                I deployed the nightly build on all six nodes – no difference. The log lines are almost the same as in the first post of this thread (all but the IDs of course :-)

                 

                Another thing with the nightly build is, that the hornetq cluster was unable to communicate until I put <security-enabled>false</security-enabled> in the configuration. But this look like another issue, it was not enought to declare cluster-user and cluster-password.

                • 5. Re: Multiple delivery to a MDB on a (clustered) topic
                  gfeuede Newbie

                  I put the complete JBoss in DEBUG logging and I see two lines, which may be a hint:

                   

                  17:18:32,849 DEBUG [org.hornetq.core.server.impl.QueueImpl] (Thread-27 (HornetQ-server-HornetQServerImpl::serverUUID=601ff423-8e20-11e1-add5-01db9b4286c7-4856794)) QueueImpl[name=3cc965d0-8b8d-4709-beca-f508565a9b48, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=601ff423-8e20-11e1-add5-01db9b4286c7]]@93ffa doing deliver. messageReferences=1

                  17:18:32,849 DEBUG [org.hornetq.core.server.impl.QueueImpl] (Thread-26 (HornetQ-server-HornetQServerImpl::serverUUID=601ff423-8e20-11e1-add5-01db9b4286c7-4856794)) QueueImpl[name=825ee253-dbd2-4c82-81e0-537d23c8de7b, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=601ff423-8e20-11e1-add5-01db9b4286c7]]@d45f89 doing deliver. messageReferences=1

                   

                  Looks like there are two topics in the jboss, right? But in the config is one topic specified ... Or are the meaning of the lines, that two instances of the MDB are created?

                  • 6. Re: Multiple delivery to a MDB on a (clustered) topic
                    Jeff Mesnil Master

                    As far as I can tell, it looks like the topic has 2 consumers bound to it and they both receive the same message.

                     

                    Is it possible to have registered twice the MDB?

                    1 of 1 people found this helpful
                    • 7. Re: Multiple delivery to a MDB on a (clustered) topic
                      gfeuede Newbie

                      Hi,

                       

                      my first suspicion was too, that the MDB was registered twice. I can't find any errors in the deployment. The content of the ear is correct, also the content of the jar with the MDB in it. For the MDB I use only the annotations, no xml deployment descriptors. The only xml in the ear are generated by maven and this setup is also simple as possible.

                        I found a workaround for my problem, I don't think it resolves the problem itself, but it does the job I want. I changed the annotation to this:

                       

                      @MessageDriven(

                              activationConfig = {

                                      @ActivationConfigProperty(

                                              propertyName = "acknowledgeMode",

                                              propertyValue = "Auto-acknowledge"

                                      ),

                                      @ActivationConfigProperty(

                                              propertyName = "destinationType",

                                              propertyValue = "javax.jms.Topic"

                                      ),

                                      @ActivationConfigProperty(

                                              propertyName = "subscriptionDurability",

                                              propertyValue = "Durable"

                                      ),

                                      @ActivationConfigProperty(

                                              propertyName = "subscriptionName",

                                              propertyValue = "consumer"

                                      ),

                                      @ActivationConfigProperty(

                                              propertyName = "clientId",

                                              propertyValue = "consumer"

                                      ),

                                      @ActivationConfigProperty(

                                              propertyName = "destination",

                                              propertyValue = "java:jboss/exported/jms/topic/deliveryTopic"

                                      )

                              }

                      )

                       

                      This produces a lot of error messages (all the same), that a subscription already exist, but it leave at least one per node, so if I ignore the errors messages, this is what I had in mind.

                       

                      One error message example is:
                              Cannot create a subscriber on the durable subscription since it already has subscriber(s)

                       

                      Is it possible, that the cause of this is the network setup? I have two network interfaces, one internal net for the cluster communication and one network for access from the »outside«?

                      • 8. Re: Multiple delivery to a MDB on a (clustered) topic
                        jaikiran pai Master

                        Can you attach the entire server.log?

                        • 9. Re: Multiple delivery to a MDB on a (clustered) topic
                          gfeuede Newbie

                          Hi,

                           

                          in the attachement is the server log. It is from the JBoss 7.1.1.Final with the workaround described above …

                          • 10. Re: Multiple delivery to a MDB on a (clustered) topic
                            jaikiran pai Master

                            The logs show that each MDB is being registered twice:

                            13:58:19,525 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) JBAS014142: Started message driven bean 'DatabaseConsumer' with 'hornetq-ra' resource adapter

                            13:58:19,529 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) JBAS014142: Started message driven bean 'DatabaseConsumerZwei' with 'hornetq-ra' resource adapter

                            13:58:19,567 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) JBAS014142: Started message driven bean 'DatabaseConsumer' with 'hornetq-ra' resource adapter

                            13:58:19,582 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) JBAS014142: Started message driven bean 'DatabaseConsumerZwei' with 'hornetq-ra' resource adapter

                            What does your application packaging look like and where are they MDBs located in the application?

                            1 of 1 people found this helpful
                            • 11. Re: Multiple delivery to a MDB on a (clustered) topic
                              gfeuede Newbie

                              Hi,

                               

                              I'm feeling so stupid. In the end, it was really an deployment bug. After your answer I checked the complete deployment and maven put the MDB in the client jar, which is used by a war in the ear. After appending »Bean« to the classnames, maven didn't put the MDB in the client jar and everthing looks fine now.

                               

                              Thank you very much!

                              • 12. Re: Multiple delivery to a MDB on a (clustered) topic
                                gfeuede Newbie

                                Thanks to you too, you where right. The reason is in the post before.