...
Wiki Markup |
---|
{snippet:id=e4|lang=java|url=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTest.java} |
JMS Sample
In this sample we want to listen for messages on a queue and process the messages with our business logic java code and send them along. Since its based on a unit test the destination is a mock endpoint.
This time we want to setup the camel context and routes using the Spring XML syntax.
Wiki Markup |
---|
{snippet:id=e1|lang=xml|url=activemq/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.xml} |
.Since the rest is standard XML stuff its nothing fancy now for the reader:
Wiki Markup |
---|
{snippet:id=e2|lang=xml|url=activemq/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.xml} |
.Our business logic is set to handle the incomming messages and fail the first two times. When its a success it responds with a Bye World
message.
Wiki Markup |
---|
{snippet:id=e2|lang=java|url=activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java} |
.And our unit test is tested with this java code. Notice that we expect the Bye World
message to be delivered at the 3rd attempt.
Wiki Markup |
---|
{snippet:id=e1|lang=java|url=activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java} |
.See Also
Include Page |
---|
| CAMEL:Using This Pattern |
---|
| CAMEL:Using This Pattern |
---|
|