2
我們在XML中具有下面的工作配置,並正試圖轉換爲DSL。不確定它們是否相同,也嘗試使用inboundAdapter。但是,我無法弄清楚如何在那裏設置併發相關值。有人可以建議他們是否在DSL中使用了這些參數中的messageDrivenChannelAdapter或inboundAdapter?Spring集成JMS DSL
<jms:message-driven-channel-adapter
id="inputChannelAdapter"
channel="inputChannel"
destination-name="inboundQueueName"
connection-factory="cachingConnectionFactory"
acknowledge="transacted"
header-mapper="defaultJmsHeaderMapper"
error-channel="errorChannel"
concurrent-consumers="10"
max-concurrent-consumers="20"/>
@Bean
public IntegrationFlow jmsInboundFlow() {
return IntegrationFlows
.from(Jms.messageDrivenChannelAdapter(cachingConnectionFactory)
.configureListenerContainer(c -> {
DefaultMessageListenerContainer container = c.get();
container.setSessionTransacted(true);
container.setSessionAcknowledgeModeName("");
container.setMaxConcurrentConsumers(30);
container.setConcurrentConsumers(20);
})
.destination(inboundQueueName).headerMapper(defaultJmsHeaderMapper)
.errorChannel("errorChannel"))
.channel(MessageChannels.queue("inputChannel"))
.get();
}
@Bean
public IntegrationFlow jmsInboundFlow1() {
return IntegrationFlows
.from(Jms.inboundAdapter(cachingConnectionFactory)
.configureJmsTemplate(t ->
t.deliveryPersistent(true).sessionTransacted(true).sessionAcknowledgeModeName(""))
.destination(inboundQueueName).headerMapper(defaultJmsHeaderMapper))
.channel(MessageChannels.queue("inputChannel"))
.get();
}