I am using Spring Integration 1.0.4 release and reading a XML message from Active MQ, transforming it using XSL to another XML and send this to IBM MQ which is then picked up by another process but that process fails as it gets invalid characters in the message XML.
The spring program is running on Windows machine, Active MQ is on Windows machine and the IBM MQ machine is on Solaris.
I am able to send messages proeprly through standalone JAVA program as below -
import com.ibm.mq.MQC;
import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQPutMessageOptions;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;
MQQueueManager queueManager = null;
MQQueue queue = null;
try {
MQEnvironment.hostname = "somehost";
MQEnvironment.port = 1414;
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERT Y, MQC.TRANSPORT_MQSERIES);
queueManager = new MQQueueManager("qmgr");
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
queue = queueManager.accessQueue("queue.output", openOptions, null, null, null);
MQMessage message = new MQMessage();
MQPutMessageOptions messageOptions = new MQPutMessageOptions();
message.writeUTF("<message></message>");
queue.put(message, messageOptions);
} catch (Exception e) {
e.printStackTrace();
} finally {
queue.close();
queueManager.disconnect();
}
The string added to the actual transformed XML are as below which is giving problem -
RFH ^B^A^D^A^Q^C3MQSTR ^D? <mcd><Msd>jms_text</Msd></mcd> X<jms><Dst>queue:///SMO.TXN.FROM.TREASURY</Dst><Tms>1283839569762</Tms><Dlv>2</Dlv></jms>\<usr><s
pringintegration_timestamp dt='i8'>1283839567402</springintegration_timestamp></usr> ....then the XML comes
The spring configuration is as below -
<bean id="inputConnectionFactory" class="org.springframework.jms.connection.CachingC onnectionFactory">
<property name="targetConnectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFacto ry">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
</property>
<property name="sessionCacheSize" value="10"/>
<property name="cacheProducers" value="false"/>
</bean>
<bean id="inputQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="queue.input"/>
</bean>
<bean id="outputConnectionFactory" class="org.springframework.jms.connection.CachingC onnectionFactory">
<property name="targetConnectionFactory">
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="hostName" value="somehost"/>
<property name="port" value="1414"/>
<property name="channel" value="SYSTEM.DEF.SVRCONN"/>
<property name="queueManager" value="qmgr"/>
<property name="transportType" value="1"/>
</bean>
</property>
<property name="sessionCacheSize" value="10"/>
<property name="cacheProducers" value="false"/>
</bean>
<bean id="outputQueue" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="queue.output"/>
</bean>
<jms:message-driven-channel-adapter
destination="inputQueue"
connection-factory="inputConnectionFactory"
channel="jmsInChannel" />
<channel id="jmsInChannel" />
<channel id="jmsOutChannel" />
<si-xml:xslt-transformer input-channel="jmsInChannel" output-channel="jmsOutChannel" xsl-resource="classpath:transform.xsl" />
<jms:outbound-channel-adapter
connection-factory="outputConnectionFactory"
destination="outputQueue"
channel="jmsOutChannel"/>
Let me know what I need to do to avoid the junk characters in the message to IBM MQ.


Reply With Quote
