svn commit: r688672 - in /activemq/camel/trunk/components/camel-spring-integration/src: main/java/org/apache/camel/component/spring/integration/ main/java/org/apache/camel/component/spring/integration
Author: ningjiang Date: Mon Aug 25 02:13:47 2008 New Revision: 688672 URL: http://svn.apache.org/viewvc?rev=688672view=rev Log: CAMEL-846 make sure the header's RETURN_ADDRESS value will be used if the output channel is not set Modified: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapterTest.java activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/adapter/CamelTarget.xml Modified: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java?rev=688672r1=688671r2=688672view=diff == --- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java (original) +++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java Mon Aug 25 02:13:47 2008 @@ -89,7 +89,7 @@ if (exchange.getPattern().isInCapable()) { headers.put(MessageHeaders.RETURN_ADDRESS , inputChannel); } -org.springframework.integration.message.Message siOutmessage = SpringIntegrationBinding.createSpringIntegrationMessage(exchange); +org.springframework.integration.message.Message siOutmessage = SpringIntegrationBinding.createSpringIntegrationMessage(exchange, headers); outputChannel.send(siOutmessage); if (exchange.getPattern().isInCapable()) { Modified: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java?rev=688672r1=688671r2=688672view=diff == --- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java (original) +++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java Mon Aug 25 02:13:47 2008 @@ -87,9 +87,13 @@ if (isExpectReply()) { //Check the message header for the return address response = SpringIntegrationBinding.storeToSpringIntegrationMessage(outExchange.getOut()); -MessageChannel messageReplyChannel = (MessageChannel) message.getHeaders().get(MessageHeaders.RETURN_ADDRESS); -if (messageReplyChannel != null) { -result = messageReplyChannel.send(response); +if (replyChannel == null) { +MessageChannel messageReplyChannel = (MessageChannel) message.getHeaders().get(MessageHeaders.RETURN_ADDRESS); +if (messageReplyChannel != null) { +result = messageReplyChannel.send(response); +} else { +throw new MessageDeliveryException(response, Can't find reply channel from the CamelTargetAdapter or MessageHeaders); +} } else { result = replyChannel.send(response); } Modified: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapterTest.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapterTest.java?rev=688672r1=688671r2=688672view=diff == --- activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapterTest.java (original) +++ activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapterTest.java Mon Aug 25 02:13:47 2008 @@ -52,17 +52,16 @@ assertEquals(Get the wrong result, MESSAGE_BODY + is processed, result); } - + public void
[CONF] Apache Camel: Tutorial-Example-ReportIncident-Part4 (attachment added)
New files attached to: CAMEL : Tutorial-Example-ReportIncident-Part4 Tutorial-Example-ReportIncident-Part4 by Claus Ibsen . Attached file(s): tutorial_reportincident_route_3.png (image/png, 16 kb) Powered by Atlassian Confluence (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request Unsubscribe or edit your notifications preferences
[CONF] Apache Camel: Quartz (page edited)
Page Edited : CAMEL : Quartz Quartz has been edited by Claus Ibsen (Aug 25, 2008). Change summary: CAMEL-845 (View changes) Content: Quartz Component The quartz: component provides a scheduled delivery of messages using the Quartz scheduler. Each endpoint represents a different timer (in Quartz terms, a Trigger and JobDetail). URI format quartz://timerName?parameters quartz://groupName/timerName?parameters quartz://groupName/timerName/cronExpression You can configure the Trigger and JobDetail using the parameters (if not using cron _expression_) Parameter Description trigger.repeatCount How many times should the timer repeat for? trigger.repeatInterval The amount of time in milliseconds between repeated triggers job.name Sets the name of the job For example the following routing rule will fire 2 timer events to the endpoint mock:results from("quartz://myGroup/myTimerName?trigger.repeatInterval=2trigger.repeatCount=1").to("mock:result"); Message Headers Camel adds the getters from Quartz Execution Context as header values. These headers is added: calendar, fireTime, jobDetail, jobInstance, jobRuntTime, mergedJobDataMap, nextFireTime, previousFireTime, refireCount, result, scheduledFireTime, scheduler, trigger, triggerName, triggerGroup. The fireTime header contains the java.util.Date for when the exchange was fired. Using Cron Triggers Quartz supports Cron-like expressions for specifying timers in a handy format. You can use these expressions in the URI; though to preserve valid URI encoding we allow / to be used instead of spaces and $ to be used instead of ?. For example the following will fire a message at 12pm (noon) every day from("quartz://myGroup/myTimerName/0/0/12/*/*/$").to("activemq:Totally.Rocks"); which is equivalent to using the cron _expression_ 0 0 12 * * ? The following table shows the URI character encodings we use to preserve valid URI syntax URI Character Cron character '/' ' ' '$' '?' See Also Configuring Camel Component Endpoint Getting Started Timer Powered by Atlassian Confluence (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request Unsubscribe or edit your notifications preferences
svn commit: r688945 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/component/bean/MethodInfo.java test/java/org/apache/camel/component/timer/TimerFiredTimeTest.java
Author: ningjiang Date: Mon Aug 25 20:03:25 2008 New Revision: 688945 URL: http://svn.apache.org/viewvc?rev=688945view=rev Log: Fixed the CS errors Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerFiredTimeTest.java Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java?rev=688945r1=688944r2=688945view=diff == --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java (original) +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java Mon Aug 25 20:03:25 2008 @@ -31,10 +31,11 @@ import org.apache.camel.Pattern; import org.apache.camel.util.ExchangeHelper; import org.apache.camel.util.ObjectHelper; -import static org.apache.camel.util.ObjectHelper.asString; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.apache.camel.util.ObjectHelper.asString; + /** * Information about a method to be used for invocation. * Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerFiredTimeTest.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerFiredTimeTest.java?rev=688945r1=688944r2=688945view=diff == --- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerFiredTimeTest.java (original) +++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerFiredTimeTest.java Mon Aug 25 20:03:25 2008 @@ -18,8 +18,8 @@ import org.apache.camel.ContextTestSupport; import org.apache.camel.Exchange; -import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; /** * Unit test for fired time exchange property
[CONF] Apache Camel: MINA (page edited)
Page Edited : CAMEL : MINA MINA has been edited by Claus Ibsen (Aug 25, 2008). Change summary: CAMEL-847 (View changes) Content: MINA Component The mina: component is a transport for working with Apache MINA URI format mina:tcp://hostname[:port] mina:udp://hostname[:port] mina:multicast://hostname[:port] mina:vm://hostname[:port} From Camel 1.3 onwards you can specify a codec in the Registry using the codec option. If you are using TCP and no codec is specified then the textline flag is used to determine if text line based codec or object serialization should be used instead. By default the object serialization is used. For UDP/Multicast if no codec is specified the default uses a basic ByteBuffer based codec. Multicast also has a shorthand notation mcast. The VM protocol is used as a direct forwarding mechanism in the same JVM. See the MINA VM-Pipe API documentation for details. A MinaProducer has a default timeout value of 30 seconds, while it waits for a response from the remote server. In normal usage Camel-mina only supports marshalling the body content - message headers and exchange properties will not be sent. However the option transferExchange does allow to transfer the exchange itself over the wire. See options below. Options Name Default Value Description codec null As of 1.3 or later you can refer to a named ProtocolCodecFactory instance in your Registry such as your Spring ApplicationContext which is then used for the marshalling textline false Only used for TCP. If no codec is specified then you can use this flag in 1.3 or later to indicate a text line based codec; if not specified or the value is false then Object Serialization is assumed over TCP. sync false/true As of 1.3 or later you can configure the exchange pattern to be either InOnly (default) or InOut. Setting sync=true means a synchronous exchange (InOut), where the client can read the response from MINA (The exchange out message). The default value has changed in Camel 1.5 to true. In older releases the default value is false. lazySessionCreation false As of 1.3 or later session can be lazy created to avoid exceptions if the remote server is not up and running when the Camel producer is started. timeout 3 As of 1.3 or later you can configure the timeout while waiting for a response from a remote server. The timeout unit is in millis, so 6 is 60 seconds. The timeout is only used for MinaProducer. encoding JVM Default As of 1.3 or later you can configure the encoding (is a charset name) to use for the TCP textline codec and the UDP protocol. If not provided Camel will use the JVM default Charset. transferExchange false Only used for TCP. As of 1.3 or later you can transfer the exchange over the wire instead of just the body. The following fields is transfered: in body, out body, in headers, out headers, exchange properties, exchange exception. minaLogger false As of 1.3 or later you can enable Apache MINA logging filter. Apache MINA uses slf4j logging at INFO level to log all input and output. Default behavior changed In Camel 1.5 the sync option has changed its default value from false to true, as we felt it was confusing for end-users when they used Mina to call remote servers and camel wouldn't wait for the response. Samples In this sample we let Camel expose a service that listen for TCP connections on port 6200. We use the textline codec meaning that we use the \n marker to indicate end-of-data. In out route we create the mina in the from to create the consumer that listen on port 6200: from("mina:tcp://localhost:6200?textline=true").to("mock:result"); As the sample is part of an unit test we test it by sending some data on port 6200 to it. Notice that we must append the \n character at the end to indicate end-of-data. This sample is a bit a typically as its async and we do not return an response. MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedBodiesReceived("Hello World"); template.sendBody("mina:tcp://localhost:6200?textline=true", "Hello World"); assertMockEndpointsSatisifed(); In the next sample we have a more common use-case where we expose a TCP service on port 6201 also using the textline codec. However this time we want to return a response so we add the sync=true option on the consumer. from("mina:tcp://localhost:6201?textline=truesync=true").process(new Processor() { public void process(Exchange exchange) throws Exception { String body = exchange.getIn().getBody(String.class); exchange.getOut().setBody("Bye " + body); } }); Then we test it by sending some data and retrieving the response using the template.requestBody() method. As we know the response is a String we cast it to String