camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sim085 <sim...@hotmail.com>
Subject Re: Can't understand what inOnly is doing
Date Tue, 27 Sep 2016 15:09:20 GMT
@Ranx, I had another look at your code. I have changed the code a little and
ran the test again. From what I can see the SEDA endpoint acts correctly to
the InOut and InOnly ExchangePattern, i.e. - acts asynchronously when called
with InOnly and synchronously when called with InOut.

Changed code and reproduced below:

[code]
import org.apache.camel.ExchangePattern;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

public class AsynchTest extends CamelTestSupport { 
	protected RouteBuilder createRouteBuilder() throws Exception { 
		return new RouteBuilder() { 
	      
			@Override 
			public void configure() { 

				from("direct:AAA")
					.to("seda:BBB")
					.log("AAA: Current Message is '${body}'");

				from("seda:BBB")
					.transform(constant("BBB"))
					.log("BBB: Current Message is '${body}'");
			} 
		}; 
	} 
	  
	@Produce(uri = "direct:AAA") 
	protected ProducerTemplate producer; 
	  
	@Test public void fireAndForget() { 
		producer.sendBody("AAA_FAF"); 
		/*
		 * This logs:
		 * 
		 * INFO  AAA: Current Message is 'AAA_FAF'
		 * INFO  BBB: Current Message is 'BBB'
		 * 
		 */
	}

	@Test public void requestReply() { 
		String result = (String) producer.requestBody("AAA_RR"); 
		System.out.println("Result: "+ result); 
		
		/*
		 * This logs:
		 * 
		 * INFO  BBB: Current Message is 'BBB'
		 * INFO  AAA: Current Message is 'BBB'
		 * Result: BBB
		 * 
		 */
	}
} 
[/code]


Ranx wrote
> If you look at the Unit test I posted earlier on that thread or even
> copy/paste it into a test class and run it you'll notice that the
> sub-route
> invocation behavior changes depending on whether the initial invocation of
> the very first endpoint is fire and forget or request/reply.  





--
View this message in context: http://camel.465427.n5.nabble.com/Can-t-understand-what-inOnly-is-doing-tp5787961p5788118.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message