A few things, in response to the various messages sent today.

First, it's definitely possible to set timeToLive for topic messages. Per
the JMS spec, TTL is implemented as a header on the message, and you can
set it (
https://docs.oracle.com/javaee/7/api/javax/jms/MessageProducer.html#setTimeToLive-long-)
irrespective of whether you're sending that message to a queue or to a
topic.

Second, as for why the configuration you listed doesn't work, did you have
a consumer on the topic in question? It's my understanding that message
expiration occurs only during dispatching to a connected consumer, so if
you're testing without a consumer, I'd expect that messages would not get
moved to the DLQ. Otherwise, your XML configuration looks fine.

Finally, Anna's statement about topics not storing messages represents the
conceptual model of how a topic works, but it's inaccurate for the actual
implementation. The broker maintains only a single copy of each message for
the topic, and then creates references to that single message for use when
tracking which subscribers still need to consume the message. When the
final subscription consumes the message, it is deleted. This
reference-tracking paradigm is used to avoid the memory usage that would
come from having many copies of the same message content in memory, though
it makes the most difference when messages are large.

Tim

On Tue, Apr 2, 2019 at 8:41 AM W.Y <wyan...@gmail.com> wrote:

> I tried the deadLetterQueue  setting for Queue works but for topic does not
> work
> ,after message expired in topic. it will not be moved to configured
> deadLetterQueue.
> below is my setting in xml, any hints or suggestions?
>
>   <destinationPolicy>
>                         <policyMap>
>                           <policyEntries>
>                            <policyEntry topic=">"
> producerFlowControl="false" memoryLimit="1mb">
>                                         <dispatchPolicy>
>                                           <strictOrderDispatchPolicy />
>                                         </dispatchPolicy>
>                                         <deadLetterStrategy>
>                                           <individualDeadLetterStrategy
> topicPrefix="Test.DLQ."
> useQueueForQueueMessages="true"/>
>                                         </deadLetterStrategy>
>                                 </policyEntry>
>
>                                 <policyEntry queue=">">
>                                   <deadLetterStrategy>
>
>                                         <individualDeadLetterStrategy
> queuePrefix="DLQ."
> useQueueForQueueMessages="true"/>
>                                   </deadLetterStrategy>
>                                 </policyEntry>
>                           </policyEntries>
>                         </policyMap>
>                   </destinationPolicy>
>
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>

Reply via email to