1
votes

I've an http service exposed in my Mule 3.3.0 flow. Now, I want to return different response on different exceptional conditions like want to differentiate if error is because of malformed xml versus incorrect input values or the error is on server side like jms is down. How can I best handle this in flow.

I tried creating private flow which catches exception and applies transformer for the desired response. When the control comes back to the calling main flow, the returned exception of private flow is treated as payload message and continues with the rest of processing. The exception returned from private flow is not returned as response of http service (as my flow is exposing http service)

Is there a way to stop the rest of flow if an exception has occurred in private flow?

I put xml verification in private flow because I want to differentiate error message thrown to user based on if its server or client error

2
" but then it is treated as payload in calling flow instead of returning the response to user." <- I don't get that part.David Dossot
Tried to explain my scenario again. Please see if it makes sense nowCharu Khurana

2 Answers

1
votes

Since the exception is processed in the private flow, you need to use standard message routing to change the processing path of the parent flow based on the outcome of the private flow.

For example, you can use a choice router after the flow-ref call and, based on the presence of some properties (or whatever makes sense in your case), either keep with the processing or return the response immediately.

0
votes

Catch Exception Strategy is the best one according to me, bcz it can be referred, and it can also be called in a choice exception.