无法从队列中提取消息
Unable to Pull Message off Queue
让我解释一下我的配置:
ActiveMQ 5.12.0
AnyPoint Studio 5.2.1
骡子 3.6.1
申请流程:
我正在使用 FunctionalTestCase post 并从队列中检索消息。
MuleClient client = muleContext.getClient();
String productAsJson = "{\"name\":\"Widget\", \"price\":9.99, \"weight\":1.0, \"sku\":\"abcd-12345\"}";
client.dispatch("http://localhost:8081/products", productAsJson, null);
MuleMessage result = client.request("jms://products", RECEIVE_TIMEOUT);
发生的事情是消息正在 posted 但是当我尝试检索它时,我得到字符串“{NullPayLoad}”。
在回溯流程后,我发现消息有效负载在使用 Mule Client 时没有生成队列。在查看 ActiveMQ 的管理控制台时,我发现消息详细信息是“{NullPayload}”。当我使用 Advance Risk Client 检查时,JSON 消息得到 post 正确编辑。
如有任何建议,我们将不胜感激。
拉斯
使用 MuleClient 时为 NullPayload,因为默认情况下 http 操作将是 GET 并且不会期望解析主体。
MuleClient 更适合使用 Mule 传输基础结构,例如 JMS 传输或旧的 http 传输。我不认为它与新的 http 侦听器模块配合得很好。
通常对于传输,您可以通过 属性 设置方法,但这似乎不适用于 http:listener:
MuleMessage message = getTestMuleMessage();
message.setPayload(productAsJson);
message.setProperty("http.method", "POST", PropertyScope.INBOUND);
client.send("http://localhost:8089/products", message);
我建议使用标准的 HTTP 客户端,例如 Apache HTTP 客户端等,并将方法设置为 POST/PUT 或您需要使用的需要主体的任何方法。
让我解释一下我的配置:
ActiveMQ 5.12.0
AnyPoint Studio 5.2.1
骡子 3.6.1
申请流程:
我正在使用 FunctionalTestCase post 并从队列中检索消息。
MuleClient client = muleContext.getClient();
String productAsJson = "{\"name\":\"Widget\", \"price\":9.99, \"weight\":1.0, \"sku\":\"abcd-12345\"}";
client.dispatch("http://localhost:8081/products", productAsJson, null);
MuleMessage result = client.request("jms://products", RECEIVE_TIMEOUT);
发生的事情是消息正在 posted 但是当我尝试检索它时,我得到字符串“{NullPayLoad}”。
在回溯流程后,我发现消息有效负载在使用 Mule Client 时没有生成队列。在查看 ActiveMQ 的管理控制台时,我发现消息详细信息是“{NullPayload}”。当我使用 Advance Risk Client 检查时,JSON 消息得到 post 正确编辑。
如有任何建议,我们将不胜感激。
拉斯
使用 MuleClient 时为 NullPayload,因为默认情况下 http 操作将是 GET 并且不会期望解析主体。
MuleClient 更适合使用 Mule 传输基础结构,例如 JMS 传输或旧的 http 传输。我不认为它与新的 http 侦听器模块配合得很好。
通常对于传输,您可以通过 属性 设置方法,但这似乎不适用于 http:listener:
MuleMessage message = getTestMuleMessage();
message.setPayload(productAsJson);
message.setProperty("http.method", "POST", PropertyScope.INBOUND);
client.send("http://localhost:8089/products", message);
我建议使用标准的 HTTP 客户端,例如 Apache HTTP 客户端等,并将方法设置为 POST/PUT 或您需要使用的需要主体的任何方法。