Hey so i need to listen in on like a dozen queues and more or less put all the incoming messages through the same processing flow. I have message driven channel adapters hooked up to each of these queues :
<jms:message-driven-channel-adapter id="101InstructionQueue1In"
channel="xmedInitiation1PrimaryChannel"
auto-startup="true"
connection-factory="${XMED.1.PRIMARY}Factory"
destination-name="${XMED.1.INITIATION}"/>
<jms:message-driven-channel-adapter id="101InstructionQueue2In"
channel="xmedInitiation2PrimaryChannel"
auto-startup="true"
connection-factory="${XMED.2.PRIMARY}Factory"
destination-name="${XMED.2.INITIATION}"/>
<jms:message-driven-channel-adapter id="201InstructionQueue1In"
channel="xmedInitiation1SecondaryChannel"
connection-factory="${XMED.1.SECONDARY}Factory"
destination-name="${XMED.1.INITIATION}"
auto-startup="true"/>
<jms:message-driven-channel-adapter id="201InstructionQueue2In"
channel="xmedInitiation2SecondaryChannel"
connection-factory="${XMED.2.SECONDARY}Factory"
destination-name="${XMED.2.INITIATION}"
auto-startup="true"/>
... and so forth.
Once the message is received, i'm routing them all into the same channel. But i'll still need to know where the message came from, so before i actually route them, i'm kinda using a header enricher to add the queue name to the message.
<channel id="xmedInitiation1PrimaryChannel" />
<header-enricher input-channel="xmedInitiation1PrimaryChannel" output-channel="initiationPreprocessingChannel" >
<header name="INITIATOR" value="PRIMARY" />
<header name="INITIATOR_NAME" value="${XMED.1.INITIATION}" />
</header-enricher>
<channel id="xmedInitiation1SecondaryChannel" />
<header-enricher input-channel="xmedInitiation1SecondaryChannel" output-channel="initiationPreprocessingChannel" >
<header name="INITIATOR" value="SECONDARY" />
<header name="INITIATOR_NAME" value="${XMED.1.INITIATION}" />
</header-enricher>
Is there any way for me to like iterate over a list of queue names and create these adapters on the fly? Perhaps using the java config? Thanks in advance.