简体   繁体   English

Spring Integration-如何以编程方式创建适配器?

[英]Spring Integration - How to create the adapters programmatically?

I am implementing spring-integration based application where i need to send messages (POJO) to ActiveMQ queues dynamically (based on message params). 我正在实现基于弹簧集成的应用程序,在该应用程序中,我需要动态地(基于消息参数)向ActiveMQ队列发送消息(POJO)。 What is the best way to implement this using spring integration concepts ? 使用spring集成概念实现此目的的最佳方法是什么?

Eg, The request message (id:123, processor:ABC) should be sent to ABC.REQUEST queue and response message should be received from ABC.RESPONSE queue. 例如,请求消息(id:123,处理器:ABC)应发送到ABC.REQUEST队列,并且应从ABC.RESPONSE队列接收响应消息。 Similarly the request message (id:456, processor:XYZ) should be sent to XYZ.REQUEST queue and response message should be received from XYZ.RESPONSE queue. 同样,应将请求消息(id:456,处理器:XYZ)发送到XYZ.REQUEST队列,并从XYZ.RESPONSE队列接收响应消息。

You don't need to programmatically create them programmatically, you can use dynamic destinations. 您不需要以编程方式创建它们,可以使用动态目标。

See request-destination-expression and reply-destination-expression in the documentation . 请参阅文档 request-destination-expressionreply-destination-expression

Something like... 就像是...

request-destination-expression="payload.processor + '.REQUEST'"
reply-destination-expression="payload.processor + '.RESPONSE'"

...should do it. ...应该这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何配置 spring 集成适配器以通过 SFTP 获取和放置文件 - How to configure spring integration adapters to get and put a file via SFTP Spring集成 - 入站和出站通道适配器 - Spring Integration - Inbound vs Outbound Channel Adapters 如何使用Java批注设置Spring Integration Collaborating Channel适配器? - How do I setup Spring Integration Collaborating Channel adapters with Java annotations? 我们可以通过编程方式获得Spring集成中的所有实时适配器吗? - can we programatically get all the live adapters in spring integration Spring集成:单元测试启动/停止端点适配器 - Spring Integration: Unit test Start/Stop endpoint adapters Spring Integration - 如何以编程方式使用 uri param / url 表达式? - Spring Integration - How to use uri param / url expression programmatically? 如何为 Spring Kafka Listener 创建集成测试 - How to Create Integration Test for Spring Kafka Listener 如何在Spring集成中动态创建ftp适配器? - how dynamic create ftp adapter in spring integration? 如何以编程方式创建春季计划的工作? - How to create spring scheduled jobs programmatically? 以编程方式设置Spring Integration Router属性 - Set a spring integration router attribute programmatically
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM