1
votes

I am implementing spring-integration based application where i need to send messages (POJO) to ActiveMQ queues dynamically (based on message params). What is the best way to implement this using spring integration concepts ?

E.g., The request message (id:123, processor:ABC) should be sent to ABC.REQUEST queue and response message should be received from ABC.RESPONSE queue. 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.

1

1 Answers

1
votes

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.

Something like...

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

...should do it.