0
votes

I have some questions on Mule.

  1. I have three components in a flow, a HTTP connector, an ObjectToJMS transformer and a JMS connector. If the ObjectToJMS transformer throws an exception when processing the data, how can I retrun a http status code of 415 to the user? Can I just add a Catch Exception Strategy and configure a set payload transformer?

  2. How can I specify the MIME type of the data that are sending to a REST web service?

2
That's a lot of questions, moreover you're not showing what you're tried already. It's as if you'd like other people to do your job ;) - David Dossot
Hi David. Thank you for that. Basically I'm doing some questions from Mule. Most of them I have tried myself but I'm not sure about some questions. - newmule

2 Answers

0
votes

You can use Catch Exception Strategy with set-payload to set response message and http:response-builder (http://www.mulesoft.org/documentation/display/current/HTTP+Response+Builder) to set HTTP status and content type.

For requests, you can set contentType on your outbound endpoint.

0
votes

IMHO, the http status code 415 should be returned if your resources's media type is not supported, not when one of your message processors fails, for this case you may want to return any 5XX codes.

To handle exception effectively Mule supports number of exception strategies. You may want to look at Error Handling of Mule.