【发布时间】:2017-12-13 03:45:20
【问题描述】:
我是 Mule 的新手,我真的很喜欢 Anypoint Studio。我试图向 ActiveMQ 发送消息。我发现如果我在字符串Payload之后直接放JMS,那么它可以工作,我可以在ActiveMQ中获取消息。如下:
但是如果我在其中放入一个 Object to JMSMessage 转换器:
它一直报错: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>
【问题讨论】: