I have started integration my Spring boot (2.2.4.RELEASE) and Apache Camel (3.8.0) with IBM-MQ server. My question is how can I send the file content to the MQ server after camel read the file and send the content to the MQ server.
In my application there is a camel-context.xml file where the route is configured.
<camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring">
<route id="route0">
<from uri="file:D:\Files\BANK\received?delete=true" />
<multicast>
<to uri="file:D:\Files\BANK\NEFTRTGS?noop=true" />
<to uri="file:D:\Files\BANK\Backup?noop=true" />
<to uri="mq:queue:DEV.QUEUE.2" />
<log message="SENT MESSAGE" />
</multicast>
<log message="MESSAGE BODY : [${body}]" />
</route>
<route id="get">
<from uri="mq:queue:DEV.QUEUE.1" />
<log message="GOT MESSAGE with headers: ${in.headers}" />
<log message="GOT MESSAGE with Body ${in.body}" />
<doTry>
<process ref="fileProcessor" />
<doCatch>
catch multiple exceptions
<exception>java.io.IOException</exception>
<exception>java.lang.IllegalStateException</exception>
<exception>java.lang.Exception</exception>
</doCatch>
</doTry>
</route>
</camelContext>
<bean id="mqConnectionFactory"
class="com.ibm.mq.jms.MQConnectionFactory">
<property name="hostName" value="localhost" />
<property name="port" value="1414" />
<property name="queueManager" value="QM1" />
<property name="channel" value="DEV.APP.SVRCONN" />
<property name="transportType" value="1" />
<property name="shareConvAllowed" value="0" />
</bean>
<bean id="mqcredential"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory"
ref="mqConnectionFactory" />
<property name="username" value="app" />
<property name="password" value="Issac@07" />
</bean>
<bean id="mq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="mqcredential" />
<property name="maxConcurrentConsumers" value="1" />
<property name="cacheLevelName" value="CACHE_CONSUMER" />
</bean>
But the problem is, whenever the specific file is generated by the system and dropped into the specific folder (in this case ‘received’ folder), camel copies the file in to two other folders and trying to send the content to the IBM MQ server. But at the MQ server screen I just find the message as below –
Now my question is why such message is shown here in the IBM MQ server screen ? The file content is completely different. The file content is : “HELLO, SENDING MESSAGE !”
But it is displayed a different characters –
message <RFH ☻>
Can anyone answer this question, why exact file content is not showing ? How can I get the exact file content in MQ server?
Thanks.