camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfaath <jfa...@apache.org>
Subject Re: error-handling advice with queues
Date Tue, 23 Mar 2010 23:02:03 GMT

I'm not sure that would work.  As I stated in my original post, I don't want
to send the entire message to the error queue, just the portion that was
invalid.  So, if my original message has, say, 11 readings, and 3 of them
are bad, I only want to send the 3 bad ones to the error queue.  During
processing, I stick the bad readings into an "error object".  It's the
contents of this object (that I can easily marshal to XML) that I want to
send to the queue.

FYI, here is a simplified version of my route:

       
from("jetty:http://0.0.0.0:8282/process").convertBodyTo(String.class)
        .inOnly("jms:queue:data.inbound")
        .unmarshal(jaxbDf)
        .beanRef("dataProcessor", "process")


Allen Lau-2 wrote:
> 
> How about just setting a header when you are done processing and there is
> an
> error?
> 
> Then in your route, just send any message to the error queue when the
> header
> is detected.
> 
> On Tue, Mar 23, 2010 at 11:57 AM, jfaath <jfaath@apache.org> wrote:
> 
>>
>> I'm looking for some advice on how to deal with errors during a large
>> processing task.  It seems like it should be simple but I'm having
>> trouble
>> figuring out what to do.
>>
>> I have an HTTP endpoint that receives XML messages then sticks them in a
>> processing queue.  From the queue, they get unmarshalled into JAXB
>> objects
>> and then processed by a Java class.  Now, the messages consist or a large
>> number of readings.  Some may be good, some may be bad.  The good ones
>> get
>> processed, but the bad ones are stuffed into a JAXB object.
>>
>> When the processing is done, I'd like to throw this object on an error
>> queue
>> (or, marshal then throw on the queue).  But I can't figure out how to do
>> this the best way.  The processing class should exit gracefully so I
>> don't
>> want to throw a final exception.
>>
>> What might be the best way to do this?  Can I add the error object to a
>> queue programmatically within the processor?  Can the processor return
>> the
>> error object so I can throw it on the queue via the route?  Is there a
>> nice
>> and easy way to do this?
>>
>> Thanks,
>>
>> JF
>> --
>> View this message in context:
>> http://old.nabble.com/error-handling-advice-with-queues-tp28005566p28005566.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/error-handling-advice-with-queues-tp28005566p28008395.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message