1

I work with JBoss EAP 7.1 (Wildfly) and have problem with configuration of queue via standalone-full.xml (ActiveMQ)

In my web application there are many MDBs with property selector: property set in header of JMS message. If the message does not have the correct property set (or no property) it remains blocked on the queue and does not go to any DLQ or Expiry Queue. Why is this? Why is it not being consumed? I have set standalone-full.xml with custom DLQ, one for any queue associated with it own MDB. It is possible to force this message to go in any other queue?

Here is the relevant XML from standalone-full.xml:

<subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">
   ...
   <address-setting name="#" page-size-bytes="2097152" max-size-bytes="10485760" expiry-address="jms.queue.ExpiryQueue" dead-letter-address="jms.queue.DLQ"/>
   <address-setting name="jms.queue.BackEndDelivery" dead-letter-address="jms.queue.BackEndDeliveryUndelivery" expiry-address="jms.queue.ExpiryQueue" redelivery-delay="10000" max-delivery-attempts="5"/>
   <address-setting name="jms.queue.FrontEndDelivery" dead-letter-address="jms.queue.FrontEndDeliveryUndelivery" expiry-address="jms.queue.ExpiryQueue" redelivery-delay="10000" max-delivery-attempts="5"/>
   ...
   <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
   <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
   <jms-queue name="BackEndDelivery" entries="java:jboss/exported/jms/queue/BackEndDelivery"/>
   <jms-queue name="FrontEndDelivery" entries="java:jboss/exported/jms/queue/FrontEndDelivery"/>
   <jms-queue name="BackEndDeliveryUndelivery" entries="java:jboss/exported/jms/queue/BackEndDeliveryUndelivery"/>
   <jms-queue name="FrontEndDeliveryUndelivery" entries="java:jboss/exported/jms/queue/FrontEndDeliveryUndelivery"/>
   ...
</subsystem>

Java EJB 3.0 MDB annotations:

@MessageDriven(activationConfig = {
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "BackEndDelivery"),
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "Action='BackEndEntryPoint'") }, mappedName = "BackEndDelivery")
@TransactionManagement(TransactionManagementType.BEAN)
Justin Bertram
  • 29,372
  • 4
  • 21
  • 43

1 Answers1

2

What you're seeing is the expected behavior. If there is a message which doesn't match the selector of any of the queue's consumers then the message won't be consumed. It would only be sent to the DLQ if a client attempted to consume the message and failed 5 times (i.e. the value you've set for max-delivery-attempts). It would only be sent to the ExpiryQueue if the message had an expiration time (which apparently it doesn't).

You can force the message to have an expiration time by setting the expiry-delay address setting, e.g.:

<address-setting name="jms.queue.BackEndDelivery" dead-letter-address="jms.queue.BackEndDeliveryUndelivery" expiry-address="jms.queue.ExpiryQueue" expiry-delay="5000" redelivery-delay="10000" max-delivery-attempts="5"/>
<address-setting name="jms.queue.FrontEndDelivery" dead-letter-address="jms.queue.FrontEndDeliveryUndelivery" expiry-address="jms.queue.ExpiryQueue" expiry-delay="5000" redelivery-delay="10000" max-delivery-attempts="5"/>

By setting expiry-delay="5000" you force any message that is not consumed within 5 seconds to be sent to the ExpiryQueue.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • It's possibile to monitor ExpiryQueue with a browser JMS (ie, Hermes)? Can i use another customized queue for example a my queue with java:jboss/exported suffix, so i can read from a client. (ExpiryQueue is a inner Jboss queue, right?) – Frank Cherry Jun 05 '19 at 20:01
  • Other thing: if expiry-delay(ms) < max-delivery-attempts*redelivery-delay(ms), the message go directly to expiry queue without processing to go in DLQ, independently from property selector. This is a tuning problem... – Frank Cherry Jun 05 '19 at 21:53
  • ExpiryQueue is just a normal queue like any other. You can browse it, consume from it, etc. I don't really understand what you're saying about the "tuning problem". Even if expiry-delay < max-delivery-attempts * redelivery-delay that can still be valid if it fits your use-case. – Justin Bertram Jun 06 '19 at 02:17
  • Suppose this: msg with right selector. In my code i have problem with external call. The timeout of this call (db connection, webservices etc.) extends timeout (10000 ms),need for delaying beetween two delivery attempts. For example, timeout=60000 ms: after 5 attempts is not 10000*5 but 60000*5, five minutes. Real test, i observed message into expiry queue after the time expiry-address that is lower than 5 minutes. I don't want this: i would my message, with correct selector, go into DLQ after 5 cycle and not in expiry queue after expiry-delay where i expects message with wrong selector. – Frank Cherry Jun 06 '19 at 13:00