0 Replies Latest reply on Jul 2, 2019 10:54 AM by wwang2016

    How to create queue with queue filtering capability

    wwang2016

      Hi All,

       

      I am investigating "queue" that can be defined with queue filter. (WildFly 15.0 Model Reference )

       

      The motivation of investigating this type of "queue" is due to a scenario of paging.

       

      With the traditional jms-queue, messages with different property values can be sent to the same queue and can be consumed later with messageConsumer set with message selector

       

      such as:

      MessageConsumer redConsumer = session.createConsumer(queue, "color='red'");

      MessageConsumer blueConsumer = session.createConsumer(queue, "color='blue'");

       

      However, in the case of paging, there may be messages that match a consumer's selector on disk in page files, but wildfly messaging does not load them into memory until another consumer reads the messages in memory and provides free space (Chapter 11. Configuring Paging - Red Hat Customer Portal ). This way, the consumption of many messages of different message selector value can be delayed until messages of a specific messages selector value were completely consumed, creating a performance issue.

       

      Based on activemq documentation (https://activemq.apache.org/components/artemis/documentation/latest/address-model.html  and  https://activemq.apache.org/components/artemis/documentation/latest/filter-expressions.html  ) , there is a different type of queue. This "queue" is different than "jms-queue" in that you could define one address, and you can define a list of queue with queue filter expression in this address.

       

      A message with some specific property value will then be sent to a specific queue (under the same address) with specific queue filter expression

      <addresses>

          <address name="filter">

              <queue name="queueRed">

                  <filter string="color='red'"/>

              </queue>

              <queue name="queueBlue">

                  <filter string="color='blue'"/>

              </queue>

         </address>

      </addresses>

       

      So a message who has a property of color='red' can be sent to queueRed.

       

      In the case of paging, consumers can be created for specific queue, and messages with different property values are already grouped to different queues, and will be processed without waiting (for specific group of messages to be processed)

       

      However, I have not found a cli command to create this kind of queue, and I am not aware of api to create it on runtime. The only information that I can find was about a pre-defined queue ( Chapter 15. Filter Expressions and Message Selectors - Red Hat Customer Portal )

       

      <subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">

        ...

        <queue

          name="myQueue"

          filter="FILTER_EXPRESSION"

          ...

        />

        ...

      </subsystem>

       

      Is there any more information on this type of queue?

       

      Thanks,

       

      Wayne