我正在尝试从jms消息存储库实现消息转发处理器。我遵循了标准的例子。我从我的api成功填充了JMS存储,但是当我激活消息处理器时,我收到以下错误。看起来我要将消息转发到的端点URL格式不正确并添加了我最初发布到的URL的一部分,以将对象放在JMS存储上。有效载荷在api中被硬编码。
ERROR - ForwardingService BlockingMessageSender of message processor
[TestStockMessageProcessor] failed to send message to the endpoint.
INFO - ForwardingService Pausing the service of the message processor
[TestStockMessageProcessor]
INFO - HTTPSender Unable to sendViaPost to
url[http://TestServer/Webservices.API/stock/stockReference/bookIn]
...Transport error : 404 Error: NOT Found
我使用谷歌REST客户端并发布到以下网址
"http://localhost:8280/dev_depot/stock/stockReference/bookIn"
我的api叫做dev_depot
以下是我的配置
我的API
<resource methods="POST" uri-template="/stock/stockReference/bookIn">
<inSequence>
<payloadFactory media-type="json">
<format> { "AreaId": 1, "StockStatusId": 1, "AbsStockNo": 1, "StockNo":
"TestJMSMS", "SKU": "7", "CatalogueNo": "300", "BadPackaging": false} </format>
<args></args>
</payloadFactory>
<property name="OUT_ONLY" value="true"></property>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"></property>
<store messageStore="JMSMS"></store>
<log level="full"></log>
</inSequence>
<outSequence>
<log level="full"></log>
</outSequence>
</resource>
消息处理器
<messageProcessor name="TestStockMessageProcessor" class="org.apache.synapse.message.processor.impl.forwarder.ScheduledMessageForwardingProcessor" targetEndpoint="TestEndpoint" messageStore="JMSMS" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="interval">1000</parameter>
<parameter name="client.retry.interval">1000</parameter>
<parameter name="max.delivery.attempts">2</parameter>
<parameter name="is.active">false</parameter>
</messageProcessor>
端点
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="TestEndpoint">
<address uri="http://TestServer/Webservices.API/stock">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
我也尝试编写代理服务并得到一个不同的错误,如下所示: -
INFO - HTTPSender Unable to send ViaPost to
url[http://TestServer/Webservices.API/stock] : No element was found to write:
java.lang.ArrayIndexOutOfBoundsException
代理服务
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="MessageProcessorTest"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<payloadFactory media-type="json">
<format> { "AreaId": 1, "StockStatusId": 1, "AbsStockNo": 1, "StockNo":
"TestProxyJMSMS", "SKU": "7", "CatalogueNo": "300", "BadPackaging": false}
</format>
<args/>
</payloadFactory>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<property name="OUT_ONLY" value="true"/>
<property name="target.endpoint" value="TestEndpoint"/>
<log level="full"/>
<store messageStore="JMSMS"/>
</inSequence>
</target>
<description/>
</proxy>
这次端点URL似乎是正确的。我使用相同的消息处理器,但填充JMS消息存储的方式不同。
会欣赏有关我做错的任何提示。
答案 0 :(得分:0)
尝试在商店介体之前在API中添加此属性:
<property name="REST_URL_POSTFIX" action="remove" scope="axis2"/>