* @throws Exception
*/
@Ignore
@Test
public void testRequestReply() throws Exception {
BrokerService broker = new BrokerService();
broker.addConnector("tcp://localhost:61616");
broker.setPersistent(false);
broker.setTimeBeforePurgeTempDestinations(1000);
broker.start();
DefaultCamelContext context = new DefaultCamelContext();
JmsComponent jmsComponent = new JmsComponent();
/**
*
*/
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
connectionFactory.setBrokerURL("failover://(tcp://localhost:61616)?maxReconnectAttempts=1");
/**
* When using Tibco EMS the problem can be recreated. As the broker is
* external it has to be stopped and started by hand.
*/
// TibjmsConnectionFactory connectionFactory = new
// TibjmsConnectionFactory();
// connectionFactory.setReconnAttemptCount(1);
jmsComponent.setConnectionFactory(connectionFactory);
jmsComponent.setRequestTimeout(1000);
jmsComponent.setReceiveTimeout(1000);
context.addComponent("jms", jmsComponent);
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("jms:testqueue").bean(new EchoServiceImpl());
from("direct:test").to("jms:testqueue");
}
});
CamelBeanPostProcessor processor = new CamelBeanPostProcessor();
processor.setCamelContext(context);
processor.postProcessBeforeInitialization(this, "this");
context.start();
String ret = proxy.echo("test");
Assert.assertEquals("test", ret);
broker.stop();
/**
* Wait long enough for the jms client to do a full reconnect. In the
* Tibco EMS case this means that a Temporary Destination created before
* is invalid now
*/
Thread.sleep(5000);
System.in.read();
broker.start(true);
/**
* Before the fix to this issue this call will throw a spring UncategorizedJmsException
* which contains an InvalidJmsDestination
*/