I'm designing an application where I need to send messages to a dynamically chosen JMS Topic. The topic should be resolved from the information contained in the Message to be sent.
I understand this can be done using a Router. However that approach requires the creation of a MessageChannel for every single topic I may use.
I'd like to use a jms : outbound-channel-adapter and use a single JmsTemplate to achieve the same result.
Looking at the source code (2.0.0.M3), I see that this could be done modifying org.springframework.integration.jms.JmsSendingMess ageHandler, using a MessageProcessor (if available) to resolve the topic name from the Message and then calling JmsTemplate.convertAndSend(String destinationName, final Object message) with the resolved name and the message.
Is this approach reasonable? Can you think of another way of resolving this?
Thanks in advance.