You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Tom Malone <th...@sns.bskyb.com> on 2008/11/11 16:14:46 UTC

Adding property before being sent to dead letter queue

I am using activemq but not camel, I want to add a property to the message,
before it arrives in the dlq, when an exception is thrown. I see this is
possible in camel, how was this done, is there anyway of doing this without
doing the dlq behaviour yourself.

Thanks in advance

Tom
-- 
View this message in context: http://www.nabble.com/Adding-property-before-being-sent-to-dead-letter-queue-tp20441595p20441595.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Adding property before being sent to dead letter queue

Posted by jmychasiw <jm...@gmail.com>.

bsnyder wrote:
> 
> Trying to do custom message processing inside of ActiveMQ is by no
> means easy to achieve. Camel is definitely the better solution for
> this type of work.
> 

We are seeking a solution to this as well.  I will be looking at Camel down
the road , but right now I have two questions about what I think is a common
usecase.

1 - We simply want to attach some error information to the message before it
goes to the DLQ.
Is this impossible to achieve this in raw JMS?  From java doc:
"If clearProperties is called, the properties can now be both read from and
written to."
Is this method only meant  for the JMS container to use? When I try it in my
listener, I get a Notwritable error.

2 - We have  have a screen where a user can move the message from the DLQ to
a main processing queue.  We are using Sping jmsTemplate.  When
'transferring' the message, the message headers were not transferred, so I
had to manually set them in the new message.  Am I missing something?

I know these are basic JMS questions, but any help would be appreciated.

Thanks.

-- 
View this message in context: http://www.nabble.com/Adding-property-before-being-sent-to-dead-letter-queue-tp20441595p21627524.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Adding property before being sent to dead letter queue

Posted by Bruce Snyder <br...@gmail.com>.
On Tue, Nov 11, 2008 at 8:14 AM, Tom Malone <th...@sns.bskyb.com> wrote:
>
> I am using activemq but not camel, I want to add a property to the message,
> before it arrives in the dlq, when an exception is thrown. I see this is
> possible in camel, how was this done, is there anyway of doing this without
> doing the dlq behaviour yourself.

Camel defines its own error handling and message processing mechanisms
that are completely separate from that of ActiveMQ. So Camel actually
consumes messages from destinations in ActiveMQ and processes them
using it's own message model. This is what makes this type of message
manipulation so easy in Camel.

Take a look at the following section of the Camel dead letter channel page:

http://activemq.apache.org/camel/dead-letter-channel.html#DeadLetterChannel-ExceptionPolicyStrategy(NewfeatureinCamel1.4)

Notice the code examples where the setHeader() method is called.
Adding a custom header to a message in Camel is this easy. For your
situation, you could just define your own behavior for the
onException() call and just define your custom header if that's all
you want to do.

Trying to do custom message processing inside of ActiveMQ is by no
means easy to achieve. Camel is definitely the better solution for
this type of work.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/