Announcement Announcement Module
No announcement yet.
Outbound message to multiple channels Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Outbound message to multiple channels


    I have an architectural question.
    I mast to do an jms-based module, what can send same message to more then one destination. The destination setup come from property set. (The topic doesn't possibility.) My base solution is done, to send message to one destination (here I used jms outbound channel adapter). The property setup doesn't change dynamically, when they set up new parameter set, then they restart the application.
    At this time the hole process has wrote in configuration file.
    	<bean id="mqConnFact" class=""> 
    		<property name="hostName" value="${MQ_HOST}" />
    		<property name="port" value="${MQ_PORT}" />
    		<property name="queueManager" value="${MQ_QUEUE_MANAGGER}" />
    		<property name="CCSID" value="${MQ_CCSID}" />
     		<property name="channel" value="${MQ_CHANNEL}" />
    		<property name="transportType">
    			<util:constant static-field="" />
        <bean id="jmsTrnManager" class="org.springframework.jms.connection.JmsTransactionManager">
            <property name="connectionFactory" ref="mqConnFact" />
    	<int:channel id="outMessSend" />
    	<bean id="mqMsgConv" class="mysource.MqMsgConv">
    		<property name="source" value="${MQ_SOURCE}" />
    		<property name="destination" value="${MQ_DEST}" />
    		<property name="ccsId" value="${MQ_CCSID}" />
    	<bean id="outputDestination" class="">
    		<constructor-arg value="${MQ_OUTPUT_QUEUE}" />
    		<property name="targetClient">
    			<util:constant static-field="" />
    	<jms:outbound-channel-adapter id="sendMessage"
    		connection-factory="mqConnFact" destination="outputDestination"
    		channel="outMessSend" message-converter="mqMsgConv" />
    I would like to take this method. (If possible.)
    I need a solution to use my properties, as a list, and the output destination can use this list to send message. (Automatically or manual.)

    I hope I can write down my problem clearly.
    Thank you!

  • #2
    Sorry; it is not clear what you are asking.

    If you want to send to a dynamic destination, use destination-expression (the expression can resolve to a Destination object or a destination name).

    If you want to send to multiple destinations, make outMessSend a <publish-subscribe-channel/> and add an adapter for each destination.


    • #3
      Hi Gary,

      Thank you your answer!

      No, I don't need dynamic destination.

      I need an easy solution to extend actual method.
      At this time I set up the needed MQ properties in a property file (because I have only one destination), and I take my data to channel, and ready.
      The customer wants to send same message two (or more) other queue. And the customer can set up a property-file (of database table), but can't update integration context of my application. I'm looking for the easy way to solve this problem.
      (The user-changes will active after the application restart.)

      Do you have any idea?



      • #4
        If you use Spring 3.x, you can set the environment; there's an example in the samples...

        Essentially, you pass the properties into the application context...

        ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(
        		new String[] { "/META-INF/spring/integration/dynamic-ftp-outbound-adapter-context.xml" },
        this.setEnvironmentForCustomer(ctx, customer);
        private void setEnvironmentForCustomer(ConfigurableApplicationContext ctx,
        		String customer) {
        	StandardEnvironment env = new StandardEnvironment();
        	Properties props = new Properties();
        	// populate properties for customer
        	props.setProperty("host", "host.for." + customer);
        	props.setProperty("user", "user");
        	props.setProperty("password", "password");
        	props.setProperty("", "/tmp");
        	PropertiesPropertySource pps = new PropertiesPropertySource("ftpprops", props);