Hi I think this has been fixed in the 1.5-SNAPSHOT
You can get the 1.5-SNAPSHOT from the download page: http://activemq.apache.org/camel/download.html Med venlig hilsen Claus Ibsen ...................................... Silverbullet Skovsgårdsvænget 21 8362 Hørning Tlf. +45 2962 7576 Web: www.silverbullet.dk -----Original Message----- From: fjelmer [mailto:[EMAIL PROTECTED] Sent: 15. oktober 2008 13:34 To: [email protected] Subject: Exchange FAULT message does not work I want to use Exchange.getFault() message to return to a message producer that something went wrong at the receiver when processing the received message. This works fine for component type 'direct'. It didn't work with JMS. Here is an example: public class FaultExample { public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); context.addComponent("jms", JmsComponent.jmsComponentClientAcknowledge(new ActiveMQConnectionFactory( "vm://localhost:61616"))); final String uri = "jms:a"; context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from(uri).process(new Processor() { public void process(Exchange exchange) throws Exception { System.out.println("Processing " + exchange.getIn()); exchange.getFault().setBody("fault!"); } }); } }); context.start(); Endpoint<Exchange> endpoint = context.getEndpoint(uri); Exchange exchange = endpoint.createExchange(ExchangePattern.InOut); exchange.getIn().setBody("hello world"); Exchange result = context.<Exchange>createProducerTemplate().send(endpoint, exchange); System.out.println("result.out: " + result.getOut()); System.out.println("result.fault: " + result.getFault()); System.out.println("result.failed: " + result.isFailed()); System.out.println("result.exception: " + result.getException()); context.stop(); System.out.println("context stopped"); } } If uri = "direct:a" I get Processing Message: hello world result.out: Message: null result.fault: Message: fault! result.failed: true result.exception: null context stopped If uri = "jms:a" I get Processing JmsMessage: ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId = ID:cisd-tp01-2749-1224069364072-2:2:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:cisd-tp01-2749-1224069364072-2:2:1:1, destination = queue://a, transactionId = null, expiration = 1224069388445, timestamp = 1224069368445, arrival = 0, brokerInTime = 1224069368445, brokerOutTime = 1224069368461, correlationId = ID-cisd-tp01/2750-1224069364587/2-0, replyTo = temp-queue://ID:cisd-tp01-2749-1224069364072-2:1:1, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = [EMAIL PROTECTED], marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 1039, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, text = null} result.out: JmsMessage: null result.fault: JmsMessage: null result.failed: true result.exception: org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 20000 millis on the exchange: Exchange[JmsMessage: hello world] context stopped BTW the application does not stop (i.e. the VM is still running). If I add the following line to method process() of the Processor exchange.getOut().setBody(""); there is no longer a timeout exception but there is still no expected FAULT message even though it has been set. Is this a bug or did I something wrong? Regards Franz-Josef Elmer -- View this message in context: http://www.nabble.com/Exchange-FAULT-message-does-not-work-tp19991688s22882p19991688.html Sent from the Camel - Users mailing list archive at Nabble.com.
