Mule AMQP传输3.6.2社区的可能错误

时间:2015-05-28 11:59:02

标签: mule amqp

我一直在追踪一些奇怪的行为,我终于设法隔离了它,我相信这是一个错误。为了重现这种行为,我创建了4个测试流程(在4个不同的mule文件中):

<flow name="testhttpFlow">
    <http:listener config-ref="HTTP_Listener_AMIAB" path="/testsend" allowedMethods="GET, POST" doc:name="HTTP"/>
    <amqp:outbound-endpoint exchangeName="AMQP.DEFAULT.EXCHANGE" routingKey="masterMeep" exchangeType="direct" responseTimeout="10000" exchange-pattern="request-response" connector-ref="connector.amqp.mule.default" doc:name="AMQP-0-9"/>
</flow>

<flow name="testsendFlow" >
    <amqp:inbound-endpoint responseTimeout="10000" exchange-pattern="request-response" doc:name="AMQP-0-9" connector-ref="connector.amqp.mule.default" exchangeName="AMQP.DEFAULT.EXCHANGE" exchangeType="direct" queueDurable="true" queueName="masterMeep"/>
    <set-payload value="#[new java.util.ArrayList()]" doc:name="Set Payload to Collection"/>
    <scripting:component doc:name="JavaScript">
        <scripting:script engine="JavaScript"><![CDATA[payload.add("something1");
        payload.add("something2");
        result=payload;]]>
    </scripting:script>
    </scripting:component>
    <set-variable variableName="payloadCollection" value="#[payload]" doc:name="Set payloadCollection"/>
    <foreach doc:name="For Each">
        <choice doc:name="Choice">
            <when expression="payload == 'something1'">
                <amqp:outbound-endpoint exchangeName="AMQP.DEFAULT.EXCHANGE" routingKey="meep" exchangeType="direct" responseTimeout="60000" exchange-pattern="request-response" connector-ref="connector.amqp.mule.default" doc:name="AMQP-0-9 meep1"/>
            </when>
            <when expression="payload == 'something2'">
                <amqp:outbound-endpoint exchangeName="AMQP.DEFAULT.EXCHANGE" routingKey="meep2" exchangeType="direct" responseTimeout="10000" exchange-pattern="request-response" doc:name="AMQP-0-9 meep2" connector-ref="connector.amqp.mule.default"/>
            </when>
            <otherwise>
                <logger level="INFO" doc:name="Logger"/>
            </otherwise>
        </choice>
        <set-payload value="#[message.payloadAs(java.lang.String)]" doc:name="To String"/>
        <logger message="#[payload]" level="INFO" doc:name="Logger"/>
        <scripting:transformer doc:name="Replace array element">
            <scripting:script engine="JavaScript"><![CDATA[var payload = message.getPayload();
                var payloadCollection = message.getInvocationProperty('payloadCollection');
                var counter = message.getInvocationProperty('counter');
                payloadCollection.set(counter - 1, payload);
                result = payload;]]></scripting:script>
        </scripting:transformer>
    </foreach>
    <logger level="INFO" doc:name="Logger" message="#[payload]"/>
</flow>

<flow name="testreceiveFlow">
    <amqp:inbound-endpoint exchangeName="AMQP.DEFAULT.EXCHANGE" queueName="meep"  exchangeType="direct" queueDurable="true" responseTimeout="60000" exchange-pattern="request-response" connector-ref="connector.amqp.mule.default" doc:name="AMQP-0-9"/>
    <set-payload value="#[message.payloadAs(java.lang.String)]" doc:name="Set Payload"/>
    <set-variable variableName="subPayload" value="#[payload]" doc:name="Variable"/>
   <http:request config-ref="HTTP_Request_Polestar" path="/api/query/ServiceProxyConfigurationLookup" method="GET" doc:name="HTTP Get ConfigXml" followRedirects="true">
        <http:request-builder>
            <http:query-param paramName="ApiName" value="customer"/>
            <http:query-param paramName="Action" value="GET"/>
            <http:query-param paramName="Section" value="TestGPO"/>
        </http:request-builder>
    </http:request>
    <json:json-to-object-transformer doc:name="JSON to Object" returnClass="java.lang.Object"/>
    <set-variable variableName="serviceProxyConfigurationLookup" value="#[payload]" doc:name="Variable"/>
    <set-payload value="#[payload[0].ServiceProxyConfiguration.ConfigurationList + &quot;\nTestReceive\n&quot; + flowVars.subPayload]" doc:name="Set Payload"/>
    <logger level="INFO" doc:name="Logger" message="&quot;Configuration XML =\n #[payload]&quot;"/>
</flow>

<flow name="testreceiveFlow2">
    <amqp:inbound-endpoint exchangeName="AMQP.DEFAULT.EXCHANGE" queueName="meep2"  exchangeType="direct" queueDurable="true" responseTimeout="60000" exchange-pattern="request-response" connector-ref="connector.amqp.mule.default" doc:name="AMQP-0-9"/>
    <set-payload value="#[message.payloadAs(java.lang.String)]" doc:name="Set Payload"/>
    <set-variable variableName="subPayload" value="#[payload]" doc:name="Variable"/>
   <http:request config-ref="HTTP_Request_Polestar" path="/api/query/ServiceProxyConfigurationLookup" method="GET" doc:name="HTTP Get ConfigXml" followRedirects="true">
        <http:request-builder>
            <http:query-param paramName="ApiName" value="customer"/>
            <http:query-param paramName="Action" value="GET"/>
            <http:query-param paramName="Section" value="TestGPO"/>
        </http:request-builder>
    </http:request>
    <json:json-to-object-transformer doc:name="JSON to Object" returnClass="java.lang.Object"/>
    <set-variable variableName="serviceProxyConfigurationLookup" value="#[payload]" doc:name="Variable"/>
    <set-payload value="#[payload[0].ServiceProxyConfiguration.ConfigurationList + &quot;\nTestReceive2\n&quot; + flowVars.subPayload]" doc:name="Set Payload"/>
    <logger level="INFO" doc:name="Logger" message="&quot;Configuration XML =\n #[payload]&quot;"/>
</flow>

最初,没有testhttp流程。 testsend流程中的端点连接器是一个HTTP连接器,完美无缺。 我立即在前面添加了额外的流,将HTTP连接器移动到该流,并添加了额外的请求 - 响应AMQP(因此等待内部AMQP请求 - 响应完成)内部AMQP请求 - 响应连接已停止工作

现在,他们只是挂起响应,直到超时发生,然后返回NullPayload。

这对我来说似乎不是正确的行为,感觉就像某种错误有两个&#34;层&#34; AMQP请求 - 响应一次进行。

有没有人让这种模式正常工作?

谢谢!

0 个答案:

没有答案