camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Elmore <belm...@qualcomm.com>
Subject RE: Handling Bean exceptions
Date Fri, 06 Jun 2008 23:58:53 GMT

Hi Claus,

I do believe that this issue (not returning an exception in the JMS
response) is indeed a bug. If you could get someone's attention about this,
I'd really appreciate it. That said, I think my workaround will be adequate,
although did discover a problem with my subclass of JmsProducer. Here's a
fixed version.

Thanks again for the help!

public class MyJmsProducer extends
org.apache.camel.component.jms.JmsProducer {

	public MyJmsProducer(JmsEndpoint endpoint) {
		super(endpoint);
	}

	@Override
	public void process(final Exchange exchange) {
		super.process(exchange);

		if (exchange.getOut() != null) {
			Object object =
((JmsEndpoint)getEndpoint()).getBinding().extractBodyFromJms(exchange,
				((JmsMessage) exchange.getOut()).getJmsMessage());

			if (object instanceof Throwable) {
				exchange.setException((Throwable) exchange.getOut().getBody());
				exchange.setOut(null);
			}
		}
	}
}


-- 
View this message in context: http://www.nabble.com/Handling-Bean-exceptions-tp17671948s22882p17703450.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message