List of usage examples for org.springframework.amqp.rabbit.core RabbitTemplate setChannelTransacted
public void setChannelTransacted(boolean transactional)
From source file:com.springsource.open.foo.ListenerApplication.java
@Bean public RabbitTemplate jmsTemplate(ConnectionFactory connectionFactory) { RabbitTemplate jmsTemplate = new RabbitTemplate(connectionFactory); jmsTemplate.setReceiveTimeout(200);//w w w. j a va 2 s .c om jmsTemplate.setChannelTransacted(true); return jmsTemplate; }
From source file:org.springframework.amqp.rabbit.core.RabbitTemplateIntegrationTests.java
@Test public void testSendAndReceiveTransactedWithUncachedConnection() throws Exception { RabbitTemplate template = new RabbitTemplate(new SingleConnectionFactory()); template.setChannelTransacted(true); template.convertAndSend(ROUTE, "message"); String result = (String) template.receiveAndConvert(ROUTE); assertEquals("message", result); result = (String) template.receiveAndConvert(ROUTE); assertEquals(null, result);//from ww w .ja v a2s . co m }