Apache Camel:ERROR WMQMsg - 预期的MQ消息characterSet''''' ' 

时间:2014-06-10 11:54:18

标签: character-encoding apache-camel ibm-mq

目前我正在使用Apache Camel并尝试写入WMQ。但是,不幸的是,我遇到了上述错误。我发现要解决这个问题,我需要将字符集或编码转换为" 819"或" ISO-8859-1"。但是,我不知道如何在apache camel中这样做。

Fyi,这是我的路线配置:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p" default-init-method="init" xmlns:util="http://www.springframework.org/schema/util" xmlns:osgi="http://www.springframework.org/schema/osgi" xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xs http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/osgi  http://www.springframework.org/schema/osgi/spring-osgi.xsd">

    <import resource="classpath:/META-INF/spring/components.xml"/>

    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">

        <route>
            <from uri="jetty:http://localhost:8888/uebermittleAusweisdaten"/>
            <process ref="TransformToXML"/>
            <to uri ="xslt:mobako.sender.xsl"/>
            <setHeader headerName="CamelJmsDestinationName">
                <constant>queue:///LSMH.ZKSEAP.SERVICEBUS?targetClient=1</constant>    
            </setHeader>
            <to uri="jms:queue:LSMH.ZKSEAP.SERVICEBUS"/>
        </route>
        <route>
            <from uri="jms:queue:ZKSEAP.LSMH.SERVICEBUS"/>
            <to uri="stream:out"/>
        </route>

    </camelContext>

</beans>

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

您可以像这样更改编码:

<convertBodyTo type="java.lang.String" charset="ISO-8859-1"/>

此处有更多信息:http://camel.apache.org/convertbodyto.html