1 Reply Latest reply on Nov 8, 2019 5:31 AM by sreckom

    Clustered MDB singleton, messages delivered to non-active server

    sreckom

      I have clustered MDB singleton deployed to four wildfly 15 servers in a cluster. Singleton is defined in jboss-ejb3.xml:

      <assembly-descriptor>
          
      <c:clustering>
              
      <ejb-name>StagingQueueWorkerMDBBean</ejb-name>
              
      <c:clustered-singleton>true</c:clustered-singleton>
          
      </c:clustering>
      
      </assembly-descriptor>
      
      

       

      It has those annotations

      @MessageDriven(name = "StagingQueueWorkerMDBBean", activationConfig =
              {
                      @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
                      @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
                      @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
                      @ActivationConfigProperty(propertyName = "destination", propertyValue = "si.telekom.jms.ActivatorStagingQueue"),
                      @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1")
              })
      @TransactionManagement(TransactionManagementType.CONTAINER)
      public class StagingQueueWorkerMDBBean implements MessageDrivenBean, MessageListener {

      If I check the queues on each server after deployment, I get the expected result as far as consumers are concerned - one server has "consumer-count" => 1, other three have "consumer-count" => 0. The problem is that when JMS messages start arriving; they are delivered to all four queues on four servers, even those that don't have any consume. I have to wait for the messages to be processed on the server that has currently active consumer, restart the server so that the singleton is migrated to the other server and they are processed there. Did I miss the point of using clustered MDB singleton? I would like to limit processing of JMS messages to one MDB in a cluster. Is there any additional configuration to be made on wildfly (maybe delivery groups, I didn't configure any). Is this the expected behaviour? I expected for all messages to be processed without restarts.