You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Shenavai, Manuel" <ma...@sap.com> on 2020/11/17 09:47:35 UTC

OnCompletion Handler

Hi everyone,

I have a question related to camel onCompletion<https://camel.apache.org/manual/latest/oncompletion.html>. I like to perform some actions after a exchange has been completed. I found two ways to do so:

  1.  Exchange.addOnCompletion<https://www.javadoc.io/doc/org.apache.camel/camel-core/2.21.0/org/apache/camel/Exchange.html#addOnCompletion-org.apache.camel.spi.Synchronization->
  2.  <onCompletion> in blueprint xml, i.e.:



<camel:route streamCache="true">
    <camel:from uri="cxf:bean:clientEndpointWSProvider"/>
    <camel:onCompletion>
        <camel:process ref="exchangeCompletedHandler"/>
    </camel:onCompletion>

...

</camel:route>



Can you recommend one approach over the other? Is there any significant difference between the solutions? The background of my questions is, that I experienced problems with solution 2) when StreamCaching was enabled in the camel route. However, with solution 1) the problem did not occur. I attached the stacktrace of the problem to this mail. I can also provide a project to reproduce the problem if required.

Thanks in advance
Best regards,
Manuel