[英]How to implement the JMS Inbound & Outbound configuration in separate spring integration application?
My use case is notification service implementation in our project. 我的用例是项目中的通知服务实现。
We have used spring with jms and its working fine with rest services. 我们已经将spring与jms结合使用,并且将其与rest服务一起使用可以正常工作。 Able to send message to queue from one application and receive a message from queue in another application using JMSTemplate's convertAndSend(), convertAndReceive() functions. 能够使用JMSTemplate的convertAndSend()和convertAndReceive()函数从一个应用程序发送消息到队列,并从另一个应用程序的队列接收消息。
Now I want to do this using spring integration's java dsl approach. 现在,我想使用Spring Integration的java dsl方法做到这一点。 We did a sample by using Jms's inboundGateway() and outboundGateway() in single application with ActiveMQ. 我们通过在具有ActiveMQ的单个应用程序中使用Jms的inboundGateway()和outboundGateway()进行了示例。
How to use spring integration's java dsl in different application for only sending/receiving messages? 如何在不同的应用程序中使用Spring Integration的java dsl仅用于发送/接收消息?
Here is my code, 这是我的代码,
@Bean
public IntegrationFlow jmsInboundFlow() {
return IntegrationFlows
.from(Jms.inboundGateway(this.connectionFactory)
.destination("pan.outbound"))
.transform((String s) -> s.toUpperCase())
.channel("in-bound-request-channel")
.get();
}
@Bean
public IntegrationFlow jmsOutboundGatewayFlow() {
return IntegrationFlows.from("out-bound-request-channel")
.handle(Jms.outboundGateway(this.connectionFactory)
.requestDestination("pan.outbound"))
.log()
.bridge()
.get();
}
@MessagingGateway
interface EchoGateway {
@Gateway(requestChannel = "out-bound-request-channel")
String send(String message);
}
You have only to split configuration - JMS inbound adapter in one application and JMS outbound in second. 您只需要拆分配置-一个应用程序中的JMS入站适配器,第二个应用程序中的JMS出站。 The way is exactly the same as in one application ? 方式与一个应用程序完全相同吗? (Maybe I missed some information?) (也许我错过了一些信息?)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.