I am attempting to implement the message forwarding processor from a jms message store. I have followed the standard example. I populate the JMS store successfully from my api but when I activate the message processor I get the following error. It looks like the endpoint url that I want to forward the message to is malformed and has added part of the url I originally posted to, to put an object on the JMS store. The payload is hard coded for the moment in the 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
I use google REST client and post to the following URL
"http://localhost:8280/dev_depot/stock/stockReference/bookIn"
My api is called dev_depot
Below is my configuration
My 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>
Message Processor
<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
<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>
I tried writing a proxy service also and got a different error as shown below :-
INFO - HTTPSender Unable to send ViaPost to
url[http://TestServer/Webservices.API/stock] : No element was found to write:
java.lang.ArrayIndexOutOfBoundsException
Proxy Service
<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>
This time the endpoint URL seems to be correct. I'm using the same message processor but different ways of populating the JMS message store.
Would appreciate any hints on what I'm doing wrong.