Asynchronous Spring集成jms AYSN同步请求/响应
我们需要使用SI服务为GUI提供服务。GUI通过JMS队列与后端通信,并等待在JMS replyTo头属性中指定的tmp队列上的响应 因此,可能有10个gui向后端进行查询,并在各自的tmp队列上接收消息 因此,我使用入站网关编写了一个SI服务,如下所示Asynchronous Spring集成jms AYSN同步请求/响应,asynchronous,jms,spring-integration,Asynchronous,Jms,Spring Integration,我们需要使用SI服务为GUI提供服务。GUI通过JMS队列与后端通信,并等待在JMS replyTo头属性中指定的tmp队列上的响应 因此,可能有10个gui向后端进行查询,并在各自的tmp队列上接收消息 因此,我使用入站网关编写了一个SI服务,如下所示 <int:channel id="inChannel" /> <int:channel id="outChannel" /> <int-jms:inbound-gateway id="jmsSampleSer
<int:channel id="inChannel" />
<int:channel id="outChannel" />
<int-jms:inbound-gateway id="jmsSampleService" request-destination-name="TEST_QUEUE_2" request-channel="inChannel"
connection-factory="qpidJmsConnectionFactory" extract-request-payload="true" error-channel="errorChannel" />
<int:service-activator input-channel="inChannel" ref="sampleService2" method="processMessage" />
public class SampleService2 {
public Response processMessage(Object obj) throws Exception {
LOG.info("Message received on sample service. ");
Thread.sleep(5000);
Response response = new ResponseImpl();
response.setPayload("Test response");
return response;
}
公共类示例服务2{
公共响应processMessage(对象obj)引发异常{
LOG.info(“示例服务上收到的消息”);
睡眠(5000);
Response Response=新ResponseImpl();
响应。设置有效载荷(“测试响应”);
返回响应;
}
这很好,我可以看到服务在jmsReplyTo队列上返回消息。但是,这是一个单线程同步操作,这意味着除非为GUI 1提供服务,否则GUI 2的调用将被阻止。我希望异步执行此操作,因为这只是对类的方法调用
我们在mule做了类似的事情
<flow name="sampleServiceFlow">
<jms:inbound-endpoint queue="TEST_QUEUE" connector-ref="queryQpidConnector" />
<byte-array-to-object-transformer />
<component>
<spring-object bean="sampleService" />
</component>
<object-to-byte-array-transformer />
<expression-filter evaluator="groovy"
expression="message.getOutboundProperty('replyToQueueName') != null" />
<jms:outbound-endpoint queue="#[header:OUTBOUND:replyToQueueName]" connector-ref="queryQpidConnector" />
</flow>
由于mule服务没有任何TXN,因此它能够简单地使用自动确认中的消息,并让SampleService的方法调用服务调用该调用
在SI中是否有这样的实现方法?可能是通过使用消息驱动的通道适配器?是否有方法在通道之间传播jms头属性?只需在入站网关上使用并发。
并发使用者
是最小最大并发使用者
(如果指定)是适配器的容器的最大值,根据需要调整并发性
我不知道你说的是什么意思
有没有办法在通道之间传播jms头属性
jms头映射到集成头,反之亦然