camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wilson, Chad (Equity Technology)" <>
Subject RE: Issue with route specific onException and jms component
Date Fri, 24 Dec 2010 10:39:16 GMT
Attachment appear to be nuked - here's the test I'm working with.

import org.apache.camel.EndpointInject;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jms.JmsComponent;
import org.apache.camel.component.jms.JmsConfiguration;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

import com.tibco.tibjms.TibjmsConnectionFactory;

public class Camel25ExceptionChangeTest extends CamelTestSupport {

	@Produce(uri = "direct:entry")
	protected ProducerTemplate entry;

	@Produce(uri = "direct:secondaryEntry")
	protected ProducerTemplate secondaryEntry;

	@EndpointInject(uri = "mock:mainEnd")
	protected MockEndpoint mainEnd;

	@EndpointInject(uri = "mock:secondaryEnd")
	protected MockEndpoint secondaryEnd;

	@EndpointInject(uri = "mock:mainErrors")
	protected MockEndpoint mainErrors;

	@EndpointInject(uri = "mock:secondaryErrors")
	protected MockEndpoint secondaryErrors;

	protected RouteBuilder createRouteBuilder() throws Exception {
		return new RouteBuilder() {
			public void configure() throws Exception {

				// Primary route (like an input route)

					// This bean generates a new
message to go down the secondary route over JMS

				// Secondary route that is invoked by
producing bean

	public void testExceptionHandlingChanges() throws Exception {

		// Create a JMS component with an invalid host name
		context.addComponent("jms", new JmsComponent(new

		// Expect original mesage to be correctly delivered
since error on secondary route is handled inside that route

		// Expect an error on this route generated from jms


		assertEquals("Expect no messages stuck in flight...", 0,

	public static class ProducingBean {

		private ProducerTemplate sendTo;

		public ProducingBean(ProducerTemplate sendTo) {
			this.sendTo = sendTo;

		public void produce(String message) {


This message w/attachments (message) is intended solely for the use of the intended recipient(s)
and may contain information that is privileged, confidential or proprietary. If you are not
an intended recipient, please notify the sender, and then please delete and destroy all copies
and attachments, and be advised that any review or dissemination of, or the taking of any
action in reliance on, the information contained in or attached to this message is prohibited.

Unless specifically indicated, this message is not an offer to sell or a solicitation of any
investment products or other financial product or service, an official confirmation of any
transaction, or an official statement of Sender. Subject to applicable law, Sender may intercept,
monitor, review and retain e-communications (EC) traveling through its networks/systems and
may produce any such EC to regulators, law enforcement, in litigation and as required by law.

The laws of the country of each sender/recipient may impact the handling of EC, and EC may
be archived, supervised and produced in countries other than the country in which you are
located. This message cannot be guaranteed to be secure or free of errors or viruses. 

References to "Sender" are references to any subsidiary of Bank of America Corporation. Securities
and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value
* Are Not a Bank Deposit * Are Not a Condition to Any Banking Service or Activity * Are Not
Insured by Any Federal Government Agency. Attachments that are part of this EC may have additional
important disclosures and disclaimers, which you should read. This message is subject to terms
available at the following link: By messaging with Sender you consent to the

View raw message