You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by emw <en...@gmail.com> on 2020/01/09 23:05:40 UTC
Custom dead letter strategy or intercept message to be sent to DLQ
This is piece of my configuration:
There a way to specify my own dead letter strategy?
Rationale behind this request is that my spring listener listen to
Consumer.XXX.VirtualTopic.*.alarms
and this is the queue related to the a virtual topic and the topic is where
mqtt client publishes:
client -> publish to <client-id>/alarms -> activemq via virtual topic
VirtualTopic.<client-id>.alarms allows me to listen to
Consumer.XXX.VirtualTopic.*.alarms and get all the alarms from all
client-idS.
I can then retrieve client-id by parsing the the original destination but if
the message for some reason is sent to DLQ miss the client.id (the original
destination is Consumer.XXX.VirtualTopic.*.alarms).
So I need I mean to put the client-id in the messages that are put in the
DLQ. That's why I'm thinking to custom (my own) dead letter strategy or a
mean for intercepting message and modify it before it is sent to the DLQ
(hoping I can still retrieve the client-id at that point).
--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Re: Custom dead letter strategy or intercept message to be sent to
DLQ
Posted by emw <en...@gmail.com>.
Solved implementing a plugin:
@Component
public class DlqBroker extends BrokerFilter {
@Override
public boolean sendToDeadLetterQueue(ConnectionContext context,
MessageReference messageReference,
Subscription subscription, Throwable poisonCause) {
...
}
conf/activemq.xml
<plugins>
...
<bean id="dlqPlugin" xmlns="http://www.springframework.org/schema/beans"
class="com.rv.activemq.plugin.dlq.DlqPlugin">
</bean>
</plugins>
--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html