You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by benshort <be...@benshort.co.uk> on 2009/01/10 11:37:54 UTC
Error Handling
Hi,
Is it possible to do something like the following mule example with service
mix?
http://www.mulesource.org/display/MULE2INTRO/Error+Handler+Example
--
View this message in context: http://www.nabble.com/Error-Handling-tp21386768p21386768.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Error Handling
Posted by benshort <be...@benshort.co.uk>.
Hi,
I want to create something like the following..
final String messageStatus = "jms:message.stats";
final String smtp =
"smtp://10.10.10.150:25?username=user&password=vvvv";
from("direct:inbox").setHeader("status",
constant("new")).multicast().to(messageStatus, "jms:inbox");
from("jms:inbox?concurrentConsumers=10").setHeader("status",
constant("sending")).multicast().to(messageStatus, smtp).to("jms:sent");
from("jms:sent").setHeader("status",
constant("sent")).to(messageStatus);
from("jms:failed").setHeader("status",
constant("failed")).to(messageStatus);
from(messageStatus).process(new Processor() {
public void process(Exchange exchange) throws Exception
{
System.err.println("####################################################################");
for ( Object key : exchange.getProperties().keySet()
) {
System.err.println("Properties " + key + " : " +
exchange.getProperty((String)key));
}
for ( Object key :
exchange.getIn().getHeaders().keySet() ) {
System.err.println("Header " + key + " : " +
exchange.getIn().getHeader((String)key));
}
System.err.println(exchange.getIn().getHeader("status") + " message " +
exchange.getExchangeId() + " " + exchange.getIn().getHeader("To"));
}
});
}
});
What I need to be able to do is log information about each send attempt.
Such as when it started and when it failed. using the deal letter channel I
can't get any information about when it resends messages.
I can get it to feed into the messageStatus when the exchange has failed >
that the max retries. but i need to know when it starts and when each retry
fails.
Can anyone point me in the right direction?
rgavlin wrote:
>
> Ben,
>
> The Camel DeadLetterChannelBuilder has a property
> "defaultDeadLetterEndpointUri" where you can explicitly specify your
> custom "dead letter" endpoint. See
> (http://svn.eu.apache.org/viewvc/servicemix/components/engines/servicemix-camel/trunk/src/test/resources/org/apache/servicemix/camel/su8-src/camel-context.xml?view=markup&pathrev=710053)
> for an example.
>
> /Ron
>
>
> benshort wrote:
>>
>> Thanks Ron that was very helpful.
>>
>> If I'm using the Dead Letter Channel and a message fails the max number
>> of allowed times can it be sent somewhere else?
>>
>> Regards
>>
>> Ben
>>
>>
>> rgavlin wrote:
>>>
>>> Hi Ben,
>>>
>>> Yes, although it is not well documented as of yet. You use the Camel
>>> ErrorHandler (http://activemq.apache.org/camel/error-handler.html)
>>> within the servicemix-camel component to handle errors in a SMX flow.
>>>
>>> See subversion commit
>>> (http://svn.eu.apache.org/viewvc?view=rev&revision=710053) for several
>>> unit tests that exercise and demonstrate this functionality.
>>>
>>> /Ron
>>>
>>>
>>>
>>> benshort wrote:
>>>>
>>>> Hi,
>>>>
>>>> Is it possible to do something like the following mule example with
>>>> service mix?
>>>>
>>>> http://www.mulesource.org/display/MULE2INTRO/Error+Handler+Example
>>>>
>>>
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Error-Handling-tp21386768p21487188.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Error Handling
Posted by rgavlin <rg...@yahoo.com>.
Ben,
The Camel DeadLetterChannelBuilder has a property
"defaultDeadLetterEndpointUri" where you can explicitly specify your custom
"dead letter" endpoint. See
(http://svn.eu.apache.org/viewvc/servicemix/components/engines/servicemix-camel/trunk/src/test/resources/org/apache/servicemix/camel/su8-src/camel-context.xml?view=markup&pathrev=710053)
for an example.
/Ron
benshort wrote:
>
> Thanks Ron that was very helpful.
>
> If I'm using the Dead Letter Channel and a message fails the max number of
> allowed times can it be sent somewhere else?
>
> Regards
>
> Ben
>
>
> rgavlin wrote:
>>
>> Hi Ben,
>>
>> Yes, although it is not well documented as of yet. You use the Camel
>> ErrorHandler (http://activemq.apache.org/camel/error-handler.html) within
>> the servicemix-camel component to handle errors in a SMX flow.
>>
>> See subversion commit
>> (http://svn.eu.apache.org/viewvc?view=rev&revision=710053) for several
>> unit tests that exercise and demonstrate this functionality.
>>
>> /Ron
>>
>>
>>
>> benshort wrote:
>>>
>>> Hi,
>>>
>>> Is it possible to do something like the following mule example with
>>> service mix?
>>>
>>> http://www.mulesource.org/display/MULE2INTRO/Error+Handler+Example
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Error-Handling-tp21386768p21405410.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Error Handling
Posted by benshort <be...@benshort.co.uk>.
Thanks Ron that was very helpful.
If I'm using the Dead Letter Channel and a message fails the max number of
allowed times can it be sent somewhere else?
Regards
Ben
rgavlin wrote:
>
> Hi Ben,
>
> Yes, although it is not well documented as of yet. You use the Camel
> ErrorHandler (http://activemq.apache.org/camel/error-handler.html) within
> the servicemix-camel component to handle errors in a SMX flow.
>
> See subversion commit
> (http://svn.eu.apache.org/viewvc?view=rev&revision=710053) for several
> unit tests that exercise and demonstrate this functionality.
>
> /Ron
>
>
>
> benshort wrote:
>>
>> Hi,
>>
>> Is it possible to do something like the following mule example with
>> service mix?
>>
>> http://www.mulesource.org/display/MULE2INTRO/Error+Handler+Example
>>
>
>
--
View this message in context: http://www.nabble.com/Error-Handling-tp21386768p21404399.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Error Handling
Posted by rgavlin <rg...@yahoo.com>.
Hi Ben,
Yes, although it is not well documented as of yet. You use the Camel
ErrorHandler (http://activemq.apache.org/camel/error-handler.html) within
the servicemix-camel component to handle errors in a SMX flow.
See subversion commit
(http://svn.eu.apache.org/viewvc?view=rev&revision=710053) for several unit
tests that exercise and demonstrate this functionality.
/Ron
benshort wrote:
>
> Hi,
>
> Is it possible to do something like the following mule example with
> service mix?
>
> http://www.mulesource.org/display/MULE2INTRO/Error+Handler+Example
>
--
View this message in context: http://www.nabble.com/Error-Handling-tp21386768p21387177.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.