2017-07-09 4 views
0

私はMuleを初めて使っています。私は本当にAnypoint Studioが大好きです。私はActiveMQにメッセージを書き込もうとしました。私は文字列ペイロードの後に​​JMSを直接置くと動作し、ActiveMQでメッセージを取得できることが分かりました。以下のように:ObjectToJMSMessageの正しいエンドポイントは何ですか?

enter image description here

しかし、私はそれでてJMSMessageトランスにオブジェクトを置く場合:

enter image description here

をそれがエラーを与え続け:java.lang.IllegalStateException: This transformer needs a valid endpoint。私はほとんどすべての種類のエンドポイントを試しましたが、役に立たなかった。私は、変圧器の正しい終点がどうなるべきか疑問に思っていますか?

コードは非常に簡単です:

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

<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd 
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd 
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd 
http://www.mulesoft.org/schema/mule/ee/wmq http://www.mulesoft.org/schema/mule/ee/wmq/current/mule-wmq-ee.xsd"> 
    <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP Listener Configuration"/> 
    <jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ" specification="1.1" password="admin" username="admin"/> 
    <flow name="basic_tutorialFlow"> 
     <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> 
     <set-payload value="hello world" doc:name="Set Payload"/> 
     <jms:object-to-jmsmessage-transformer doc:name="Object to JMSMessage"/> 
     <jms:outbound-endpoint connector-ref="Active_MQ" doc:name="JMS" topic="mytopic"/> 
     <object-to-string-transformer doc:name="Object to String"/> 
    </flow> 
</mule> 

答えて

1

JMSフロー要素間で使用する場合、あなたのxmlを観察する場合、それはすでに「JMS:アウトバウンド・エンドポイント」それを持っている(ように発信エンドポイントとして機能し.WhatペイロードがJMSエンドポイントをコンフィグレーションしたキューまたはトピックにパブリッシュされることを意味します)。

通常、シナリオでは、JMS送信エンドポイントMuleがメッセージを暗黙的に変換する前にトランスフォーマを用意する必要はありません。その結果、JMSインバウンドエンドポイント(jms:インバウンドエンドポイント)であるこのキュー/トピックを読み取っている新しいフローまたはアプリケーションを作成することができます。これは、JMSコンポーネントを配置する場所に応じて、インバウンドまたはアウトバウンド)。

あなたが達成しているのは、信頼性のパターンです。あなたはここでそれについてもっと読むことができます。

https://docs.mulesoft.com/mule-user-guide/v/3.8/reliability-patterns

+0

ありがとうございます!私はいつこの "Object to JMSMessage"トランスを使用すべきかを知りたいですか?そして私がそれを使うと、どのコンポーネントがエンドポイントになるのでしょうか? –

関連する問題