Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
428 views
in Technique[技术] by (71.8m points)

What format should a queue's filter have in ActiveMQ Artemis?

I need information about ActiveMQ Artemis filters. I have reviewed the official documentation, but I cannot find an adequate explanation. I may be missing something to review.

  • What format should a queue's filter have?
  • What element can be used in a message to filter (e.g. headers, properties, etc.)?

I would appreciate any examples or resources.

question from:https://stackoverflow.com/questions/65848076/what-format-should-a-queues-filter-have-in-activemq-artemis

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Regarding the "format" (i.e. syntax) the filter documentation states:

Apache ActiveMQ Artemis provides a powerful filter language based on a subset of the SQL 92 expression syntax.

It is the same as the syntax used for JMS selectors, but the predefined identifiers are different. For documentation on JMS selector syntax please the JMS javadoc for javax.jms.Message.

Specifically, see the whole Message Selectors section in the aforementioned JavaDoc for a full description of the selector syntax.

There are a handful of special message attributes that can be used in filters along with any actual message property. As the documentation states:

The following identifiers can be used in a core filter expressions to refer to attributes of the core message in an expression:

  • AMQPriority. To refer to the priority of a message. Message priorities are integers with valid values from 0 - 9. 0 is the lowest priority and 9 is the highest. E.g. AMQPriority = 3 AND animal = 'aardvark'

  • AMQExpiration. To refer to the expiration time of a message. The value is a long integer.

  • AMQDurable. To refer to whether a message is durable or not. The value is a string with valid values: DURABLE or NON_DURABLE.

  • AMQTimestamp. The timestamp of when the message was created. The value is a long integer.

  • AMQSize. The size of a message in bytes. The value is an integer.

Any other identifiers used in core filter expressions will be assumed to be properties of the message.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...