DSL: JMS in/out adapters, outbound gateway

* Others fixes, improvements and refactoring
This commit is contained in:
Artem Bilan
2014-06-11 19:16:57 +03:00
parent 7394516a2d
commit b42e6e1503
19 changed files with 680 additions and 25 deletions

View File

@@ -942,6 +942,24 @@ public class IntegrationFlowTests {
assertEquals("HELLO THROUGH THE AMQP", receive.getPayload());
}
@Autowired
@Qualifier("jmsOutboundInboundChannel")
private MessageChannel jmsOutboundInboundChannel;
@Autowired
@Qualifier("jmsOutboundInboundReplyChannel")
private PollableChannel jmsOutboundInboundReplyChannel;
@Test
public void testJmsOutboundInboundFlow() throws Exception {
this.jmsOutboundInboundChannel.send(MessageBuilder.withPayload("hello through the amqp").build());
Message<?> receive = this.jmsOutboundInboundReplyChannel.receive(5000);
assertNotNull(receive);
assertEquals("HELLO THROUGH THE AMQP", receive.getPayload());
}
@MessagingGateway(defaultRequestChannel = "controlBus")
private static interface ControlBusGateway {
@@ -1005,6 +1023,22 @@ public class IntegrationFlowTests {
return MessageChannels.publishSubscribe().get();
}
@Bean
public IntegrationFlow jmsOutboundFlow() {
return IntegrationFlows.from("jmsOutboundInboundChannel")
.handle(Jms.outboundAdapter(this.jmsConnectionFactory).destination("jmsOutboundInboundChannel"))
.get();
}
@Bean
public IntegrationFlow jmsInboundFlow() {
return IntegrationFlows.from(Jms.inboundAdapter(this.jmsConnectionFactory).destination("jmsOutboundInboundChannel"))
.<String, String>transform(String::toUpperCase)
.channel(MessageChannels.queue("jmsOutboundInboundReplyChannel"))
.get();
}
}
@Configuration
@@ -1394,7 +1428,7 @@ public class IntegrationFlowTests {
@Bean
public IntegrationFlow amqpOutboundFlow() {
return IntegrationFlows.from(Amqp.channel("amqpOutboundInput", this.rabbitConnectionFactory))
.handle(Amqp.outboundAdapter(this.amqpTemplate).routingKeyExpression("headers.routingKey").get())
.handle(Amqp.outboundAdapter(this.amqpTemplate).routingKeyExpression("headers.routingKey"))
.get();
}