简体   繁体   中英

Manual ack Google pubsub messages from Apache Camel route

I have a main Camel Route(Poller) which starts from Google PubSub component and calls a secondary route that goes to an HTTP endpoint. If I get any exceptions such as Network or Endpoint down (HTTP 500, 400 etc) then I don't want the message to be nACKED instead I want all messages to be ACKed regardless of whether the route succeeds.

I am looking at options to ACK regardless of route outcome. So far not able to find any methods or Props on Exchange etc.

I know this is not ideal but I have a requirement this way. I have tried using a custom pubsub connection factory like in thisquestion ( How to manually ack/nack a PubSub message in Camel Route ) but it doesn't seem to help in my case as I still don't seem to be able to ack them back.

Any ideas on how I can do this or any examples that can help me. Thank you.

Supposedly this should work:

Add a processor in your Camel route that does this:

exchange.getUnitOfWork().done(exchange);

It should ack the message regardless of the source (google pubsub in this case)...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM