ActiveMQ で WSO2 ESB 4.7.0 を使用しています。このwso2 ドキュメントに従って、単純なストア アンド フォワード構成を実装しようとしています。
JMS に格納して転送するために使用しているプロキシは次のとおりです。
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="testJMSStorenFwd"
transports="http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence onError="fault">
<property name="messageType" value="application/json" scope="axis2"/>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
<property name="OUT_ONLY" value="true"/>
<log level="full"/>
<property name="target.endpoint" value="JMSRcvEndPoint" format="soap11"/>
<store messageStore="FMSReadings"/>
<!--send>
<endpoint key="JMSRcvEndPoint" format="soap11"/>
</send-->
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>
メッセージが最終的に転送されるエンドポイントは次のとおりです。
<?xml version="1.0" encoding="UTF-8"?>
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="JMSRcvEndPoint">
<address uri="http://kk1:8282/services/testJMSRcvProxy" format="soap11"/>
</endpoint>
転送されたメッセージを受信するプロキシは次のとおりです (このテストでは、受信したメッセージをログに記録するだけです)。
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="testJMSRcvProxy"
transports="http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence onError="fault">
<property name="messageType" value="application/json" scope="axis2"/>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
<log level="full"/>
<drop/>
</inSequence>
<outSequence>
<drop/>
</outSequence>
</target>
</proxy>
ここに私のメッセージストアがあります:
<?xml version="1.0" encoding="UTF-8"?>
<messageStore xmlns="http://ws.apache.org/ns/synapse"
class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore"
name="FMSReadings">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
</messageStore>
ここに私の MessageProcessor があります:
<?xml version="1.0" encoding="UTF-8"?>
<messageProcessor xmlns="http://ws.apache.org/ns/synapse"
class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor"
name="fwdTotestJMSRcvProxy"
messageStore="FMSReadings">
<parameter name="interval">1000</parameter>
</messageProcessor>
以下のように、非常に基本的な JSON で単純な curl コマンドを使用して、このセットアップをテストしています。
curl -v -H "Accept: application/json" -H "Content-Type:application/json" -d '{"mail":"faisal.shaik@youtility.in"}' http://kk1:8282/services/testJMSStorenFwd
これを実行すると、セットアップによってメッセージが保存および転送されます (メッセージがキューに入れられ、キューから取り出されたことを ActiveMQ Web UI から確認できます) が、ESB ログに以下のエラーが表示されます。
[2013-08-27 14:24:44,052] INFO - To: /services/testJMSStorenFwd, MessageID: urn:uuid:bb553e52-ee61-4d15-8c1f-19be1356c8e0, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><mail>faisal.shaik@youtility.in</mail></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
[2013-08-27 14:24:44,085] ERROR - Error building message {org.apache.synapse.transport.passthru.util.DeferredMessageBuilder}
org.apache.axis2.AxisFault: Failed to convert JSON to XML payload. Expected a ',' or '}' at character 50 of { "xmlPayload" : <mail>faisal.shaik@youtility.in</mail>}
at org.apache.axis2.json.JSONBuilder.processDocument(JSONBuilder.java:86)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:118)
上記の testJMSStorenFwd プロキシで気付いた場合は、送信セクションがコメントアウトされています。それをコメント解除してコメントアウトすると、
<property name="target.endpoint" value="JMSRcvEndPoint" format="soap11"/>
<store messageStore="FMSReadings"/>
セクションでは、json を適切に xml に変換し、次のログの出力を取得します。
[2013-08-27 14:53:27,333] INFO - To: /services/testJMSStorenFwd, MessageID: urn:uuid:e482aba1-98a9-4181-9c8e-c5110dcefd09, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><mail>faisal.shaik@youtility.in</mail></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
[2013-08-27 14:53:27,346] INFO - To: /services/testJMSRcvProxy, MessageID: urn:uuid:e6da7131-60ec-4c92-b204-e3843f7e6e91, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Envelope><soapenv:Body><mail>faisal.shaik@youtility.in</mail></soapenv:Body></soapenv:Envelope></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
上記からわかるように、同じ設定を使用して messagestore および messageprocessor メカニズムに同じ入力を行うと、JSON から XML への変換エラーが発生します。
これは wso2 esb MessageStore および/または MessageProcessor のバグですか、それとも何か間違っていますか? スクリプト メディエータに頼らずに、この JMS ストア アンド フォワードを使用しているときに発生するエラーを取り除く方法はありますか?