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

  • Outbound message to multiple channels

    Hi,

    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.
    Code:
    	<bean id="mqConnFact" class="com.ibm.mq.jms.MQQueueConnectionFactory"> 
    		<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="com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP" />
    		</property>
    	</bean>
    
        <bean id="jmsTrnManager" class="org.springframework.jms.connection.JmsTransactionManager">
            <property name="connectionFactory" ref="mqConnFact" />
        </bean>
    
    	<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>
    
    	<bean id="outputDestination" class="com.ibm.mq.jms.MQQueue">
    		<constructor-arg value="${MQ_OUTPUT_QUEUE}" />
    		<property name="targetClient">
    			<util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_JMS_COMPLIANT" />
    		</property>
    	</bean>
    
    	<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!
    Feri

  • #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.

    Comment


    • #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?

      Thx!
      Feri

      Comment


      • #4
        If you use Spring 3.x, you can set the environment; there's an example in the samples... https://github.com/SpringSource/spri...ed/dynamic-ftp

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

        Code:
        ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(
        		new String[] { "/META-INF/spring/integration/dynamic-ftp-outbound-adapter-context.xml" },
        		false);
        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("remote.directory", "/tmp");
        	PropertiesPropertySource pps = new PropertiesPropertySource("ftpprops", props);
        	env.getPropertySources().addLast(pps);
        	ctx.setEnvironment(env);
        }

        Comment

        Working...
        X