Hello,
In our application, we have factored out some common behaviour in a direct:
route called synchronously by other routes
This sub-route needs to handle exception by first making retries ; and
then, when retry are exhausted, by returning **to the caller route** a
default intermediary response.
Playing around with onException directive on this direct sub-route, I did
not succeed to achieve the last part :
* the retries do work correctly ( with required redelivery policy
directive : maximumRedeliveries in particular )
* when retries are exhausted the custom exception policy is correctly
executed : it marks the exception as "handled" and set the body on the
exchange with the default intermediary response
* BUT the processing of the exchange completely ends after that : the
parent route didn't continue its processing based on this intermediary
response
* and in the ends the caller of the main route receives an intermediary
response, which is not in the format it expects.
I know there is doTry/doCatch directives, which would allow to return a
default response without involing errorHandler, but we can't use them here
as we also do need the redelivery behaviour of the default error handler.
Digging a little into the camel source code, I understand that this
behaviour is caused by the fact that both routes (main route / sub-route)
are sharing the same Exchange when using direct: endpoint,
and that in this case, the error handler of the sub-route flags the
Exchange has errorHandlerHandled which caused BOTH routes to stop their
processing.
I didn't succeed to find reference material on this specific behaviour on
direct endpoint.
It seems to me to be a fairly reasonable requirement though.
Is it possible to achieve what we need here ?
Thanks in advance for your advices
Regards,
Fabien Arrault
--
This e-mail, any attachments and the information contained therein ("this
message") are confidential and intended solely for the use of the
addressee(s).
If you have received this message in error please send it
back to the sender and
delete it. Unauthorized publication, use,
dissemination or disclosure of this
message, either in whole or in part is
strictly prohibited.
Ce message électronique et tous les fichiers
joints ainsi que les informations contenues dans ce message (ci-après "le
message") sont confidentiels et destinés exclusivement à l'usage de la
personne à laquelle ils sont adressés. Si vous avez reçu ce message par
erreur, merci de le renvoyer à son émetteur et de le détruire. Toute
diffusion, publication, totale ou partielle ou divulgation sous quelque
forme que ce soit non expressément autorisée de ce message, est interdite.