You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vishal1981 <vi...@ericsson.com> on 2012/08/16 01:08:17 UTC

Customer PollingConsumerPollStrategy but with message header or exchange property

Hi,

I want to log any and all FTP failures when using an FTP consumer. As I
understand I have to,
1. Implement -PollingConsumerPollStrategy
2. set throwExceptionOnConnectFailed=true on the FTP URI. (Is there an
equivalent one for File endpoint?)
3. Also setting, consumer.bridgeErrorHandler=true to handle other exception
happening after Poll finishes.

Now my question is,
1. If I set consumer.bridgeErrorHandler=true (using Camel 2.10)do I still
need to implement PollingConsumerPollStrategy? or will my FTP exception be
automatically handled by the onException clause set on the whole context?
2. The logging is done via a Stateless EJB and I dont want to create one
instance for each FTP consumer rather share one for all FTP consumers.
However I want to customize the Error Message with something specific to the
endpoint URI which caused the exception. I have set a header on the message
after the FTP consumer via 
from("ftp://....").setHeader("PROVIDER_ID",
simple(Long.toString(provider.getId()), Long.class)) but as I understand if
FTP fails there will not even be an exchange that will be created. Hence in
my rollback method in the PollingConsumerPollStrategy implementation I have
no way to get PROVIDER_ID which I need to log. I cannot reverse look up
provider_id using the endpoint URI either.

Is there any other way to achieve this? Pass in an extra parameter to the
rollback method
Thanks in advance,
-v-



--
View this message in context: http://camel.465427.n5.nabble.com/Customer-PollingConsumerPollStrategy-but-with-message-header-or-exchange-property-tp5717451.html
Sent from the Camel - Users mailing list archive at Nabble.com.