Configuring the same dead letter queue for several JMS queues in JBoss 7.1

微笑、不失礼 提交于 2019-12-11 07:54:49

问题


I have a java application running on JBoss 7.1. It is using more than 20 JMS-queues.

My configuration to setup the JMS queues:

<jms-queue name="MX.EQ.DT.MT.OUT">
   <entry name="queue/MX.EQ.DT.MT.OUT"/>
   <entry name="java:jboss/exported/jms/queue/MX.EQ.DT.MT.OUT"/>
</jms-queue>

<jms-queue name="MX.EQ.DS.XML.OUT">
   <entry name="queue/MX.EQ.DS.XML.OUT"/>
   <entry name="java:jboss/exported/jms/queue/MX.EQ.DS.XML.OUT"/>
</jms-queue>

Now, I want to configure the dead letter queue for above two queues. What value would I have to use for the match?

I can not use #, because it will be applicable to all JMS queues, but I only want the two.

<address-setting match="jms.queue.MX.EQ.*.*.OUT">
   <dead-letter-address>jms.queue.DLQ</dead-letter-address>
   <expiry-address>jms.queue.ExpiryQueue</expiry-address>
   <redelivery-delay>0</redelivery-delay>
   <max-size-bytes>10485760</max-size-bytes>
   <address-full-policy>BLOCK</address-full-policy>
   <message-counter-history-day-limit>10</message-counter-history-day-limit>
</address-setting>

Also is there anyway to push back the message from dead letter queue to originating queue?

I am using hornet queue version 2.2.13 and want to use the wild card as MX.EQ.*.*.OUT. If I put * or # in between the characters, the server throws an exception during boot.


回答1:


According Understanding the HornetQ Wildcard Syntax:

A HornetQ wildcard expression contains words delimited by the character '.' (full stop).

The special characters '#' and '*' also have special meaning and can take the place of a word.
The character '#' means 'match any sequence of zero or more words'.
The character '*' means 'match a single word'.

So the wildcard 'news.europe.#' would match 'news.europe', 'news.europe.sport', 'news.europe.politics', and 'news.europe.politics.regional' but would not match 'news.usa', 'news.usa.sport' nor 'entertainment'.

The wildcard 'news.*' would match 'news.europe', but not 'news.europe.sport'.
The wildcard 'news.*.sport' would match 'news.europe.sport' and also 'news.usa.sport', but not 'news.europe.politics'.

In your configuration you could use the wilcard *, but in JBoss 7.1.1 the cofiguration parser throws a exception when you put a value with character *.

The error is similar to:

JBAS015956: Caught exception during boot: org.jboss.as.controller.PathElement$OperationClientIllegalArgumentException: JBAS014719: Invalid value specification

The same problem occurs when you use a space in the value, this problem is described in: Logger category cannot have spaces

Now one option is update to JBoss 7.1.2 or higher, or create a different nomenclature for the name of queues, for example:

<jms-queue name="group1.q1">
    <entry name="queue/group1.q1"/>
    <entry name="java:jboss/exported/jms/queue/group1.q1"/>
</jms-queue>
<jms-queue name="group1.q2">
    <entry name="queue/group1.q2"/>
    <entry name="java:jboss/exported/jms/queue/group1.q2"/>
</jms-queue>

and address-setting:

<address-setting match="group1.#">
    <dead-letter-address>jms.queue.DLQ</dead-letter-address>
    <expiry-address>jms.queue.ExpiryQueue</expiry-address>
    <redelivery-delay>0</redelivery-delay>
    <max-size-bytes>10485760</max-size-bytes>
    <address-full-policy>BLOCK</address-full-policy>
    <message-counter-history-day-limit>10</message-counter-history-day-limit>
</address-setting>

The wilcard # only can be use at the end of the match.



来源:https://stackoverflow.com/questions/27692567/configuring-the-same-dead-letter-queue-for-several-jms-queues-in-jboss-7-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!