Spring integration Spring集成DSL在Java1.7中创建JMS出站适配器
我正在尝试为JMS OutboundAdapter创建一个集成流,需要通过它向ActiveMQTopic发送消息。但我真的 当我试图将xml标记转换为特定于dsl的代码时卡住了,无法将某些xml标记转换为所需的dsl。能提供任何一个吗 任何指向它的指针,因为我无法继续 这是我的连接工厂和活动MQTopicbeanSpring integration Spring集成DSL在Java1.7中创建JMS出站适配器,spring-integration,Spring Integration,我正在尝试为JMS OutboundAdapter创建一个集成流,需要通过它向ActiveMQTopic发送消息。但我真的 当我试图将xml标记转换为特定于dsl的代码时卡住了,无法将某些xml标记转换为所需的dsl。能提供任何一个吗 任何指向它的指针,因为我无法继续 这是我的连接工厂和活动MQTopicbean @Bean public ActiveMQConnectionFactory ConnectionFactory() { ActiveMQConnectionF
@Bean
public ActiveMQConnectionFactory ConnectionFactory() {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
factory.setBrokerURL(brokerUrl);
return factory;
}
@Bean
public ActiveMQTopic mqTopic() {
return new ActiveMQTopic(jmstopic);
}
这是我制作的队列通道和集成流
@Bean
public QueueChannel jmsOutChannel(){
return new QueueChannel();
}
@Bean
public IntegrationFlow jmsOutboundFlow() {
return IntegrationFlows.from(jmsOutChannel())
.handle(Jms.outboundAdapter(ConnectionFactory())
.destination(mqTopic()))
.get();
}
但我需要将下面的xml转换成所需的DSL。无法在我的流中添加轮询器
<int-jms:outbound-channel-adapter id="jmsOutbound" channel="jmsOutChannel" destination="jmsQueue"
connection-factory="connectionFactory" pub-sub-domain="true">
<int:poller fixed-delay="10000" receive-timeout="0"/>
</int-jms:outbound-channel-adapter>
<int:channel id="jmsOutChannel" >
<int:queue capacity="10"/>
</int:channel>
我对您的问题进行了一些编辑,特别是在最后一段代码中,以找出您真正需要转换的内容 首先请注意,不要为
jmsOutChannel()
指定capacity=“10”
。这是一个非常简单的问题。所以,请你自己试着遵循你的代码:我们不能为你做所有的工作
现在关于
和DSL。正如您在XML配置变体中看到的那样,
是
配置的一部分,Java DSL在这方面没有发明任何新东西,PollerMetadata
也与端点
配置绑定在一起:
@Bean
public IntegrationFlow jmsOutboundFlow() {
return IntegrationFlows.from(jmsOutChannel())
.handle(Jms.outboundAdapter(ConnectionFactory())
.destination(mqTopic()),
new Consumer<GenericEndpointSpec<JmsSendingMessageHandler>>() {
void accept(GenericEndpointSpec<JmsSendingMessageHandler> spec) {
spec.poller(Pollers.fixedDelay(10000)
.receiveTimeout(0));
}
})
.get();
}
@Bean
公共集成流jmsOutboundFlow(){
返回IntegrationFlows.from(jmsOutChannel())
.handle(Jms.outboundAdapter(ConnectionFactory())
.destination(mqTopic()),
新消费者(){
无效接受(GenericEndpointSpec){
规格轮询器(轮询器固定延迟(10000)
.接收超时(0);
}
})
.get();
}
诸如此类。你好,阿尔特姆,非常感谢你的帮助。。。实际上,我没有传递capacity=“10”的构造函数参数。我将相应地更新我的代码。