JMS Not working in Wso2Esb 4.7.0 - wso2

i am working with wso2esb 4.7.0 and ActiveMQ5.8.0 whenever i am working with wso2esb4.6.0 and ActiveMQ5.5.1 its working fine i am publishing my configuration below any one help for this
message store
<messageStore xmlns="http://ws.apache.org/ns/synapse"
class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore"
name="JMSQueue">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.jms.destination">JMS_Reading_Queue</parameter>
</messageStore>
message processor
<messageProcessor xmlns="http://ws.apache.org/ns/synapse"
class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor"
name="faisal"
messageStore="JMSQueue">
<parameter name="max.delivery.attempts">4</parameter>
<parameter name="interval">1000</parameter>
</messageProcessor
and proxy is like this
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Jms"
transports="https http jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="messageType" value="application/json" scope="axis2"/>
<log level="full"/>
<store messageStore="JMSQueue"/>
<property name="target.endpoint"
value="JmsEndpoint"
scope="default"
type="STRING"/>
</inSequence>
<outSequence/>
</target>
</proxy>
and i defined my endpoint in endpoints
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="JmsEndpoint">
<address uri="http://192.168.1.122:8282/services/ReadingsMobile"
format="soap11"/>
</endpoint>
now i am getting no target endpoint errors same configuration working in wso2esb4.6.0 mbut not working in wso2esb4.7.0
and its giving errors like this
[2013-08-21 16:48:32,049] WARN - ForwardingHandler Property target.endpoint not found in the message context. Removing the message.
[2013-08-21 16:49:32,093] WARN - SourceHandler Connection time out after request is read: http-incoming-13

Try doing the below modifications in the proxy configuration in order to get rid of the warnings;
a) Replace < target > with < target endpoint="JmsEndpoint" >
b) Move the "store" tag entry after the property where you set the "target.endpoint".
These changes seem to do the trick in my environment. Check if it fixes your issue too.
Hope this helps.

Basically the error you are getting says message processor cannot find the target.endpoint property from the stored message context.
The reason for this is, you are storing the message before setting this property.
You have to set the 'target.endpoint' property before the store mediator in the flow.
Proxy configuration should look likes follows.
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Jms"
transports="https http jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="messageType" value="application/json" scope="axis2"/>
<log level="full"/>
<property name="target.endpoint"
value="JmsEndpoint"
scope="default"
type="STRING"/>
<store messageStore="JMSQueue"/>
</inSequence>
<outSequence/>
</target>
</proxy>

Related

Guaranteed Delivery of Messages with Active MQ and WSO2 EI

Issue: i have a proxy service which consumes only XML message, but sometimes if we are getting XML message with not proper format,just syntax error,our proxy should send that message to a different queue,the message should not loss.
i have followed the below link but unable to get the expected output
https://www.yenlo.com/blog/guaranteed-message-deliveries-part-3-monitoring-the-redelivery-policy
Below is my proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="RollbackProxy" startOnLoad="true" transports="jms" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log description="" level="full">
<property name="****************" value="******************************"/>
</log>
</inSequence>
<outSequence/>
<faultSequence>
<property name="SET_ROLLBACK_ONLY" scope="axis2" type="STRING" value="true"/>
<log category="ERROR" level="full">
<property expression="$ctx:ERROR_CODE" name="error_code"/>
<property expression="$ctx:ERROR_MESSAGE" name="error_message"/>
<property expression="$ctx:ERROR_DETAIL" name="error_detail"/>
</log>
</faultSequence>
</target>
<parameter name="transport.jms.Destination">QueueName</parameter>
<parameter name="transport.jms.ContentType">
<rules xmlns="">
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>
</proxy>
axis2.xml and activemq.xml i have properly updated.
we are using active MQ.
Can somebody guide me on this?
Thanks in Advance

Correct configuration for transport Sender & Receiver JMS?

I have some questions because documentation is not clear..
How should I setup WSO2 ESB environment to be able to read and write messages form WSO2 MessageBroker.
I followed ConfigurewithWSO2MessageBroker
I have ESB and MB on same server (MB has Offset=2)
/repository/conf/axis2/axis2.xml
....
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="JMSTopic" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
<parameter name="JMSQueue" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
</transportReceiver>
...
and sender part
<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender">
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ConnectionFactory</parameter>
</parameter>
</transportSender>
jndi.properties files
connectionfactory.QueueConnectionFactory = amqp://admin:admin#clientID/carbon?brokerlist='tcp://gst-esb-qa-01:5674'
connectionfactory.TopicConnectionFactory = amqp://admin:admin#clientID/carbon?brokerlist='tcp://gst-esb-qa-01:5674'
connectionfactory.ConnectionFactory = amqp://admin:admin#clientID/carbon?brokerlist='tcp://gst-esb-qa-01:5674'
queue.myQueue = myQueue
queue.testQueue= testQueue
topic.MyTopic = MyTopic
My proxy
<proxy name="SendMessagetoJMSProxy" transports="http" startOnLoad="true">
<target>
<endpoint>
<address uri="jms:/myQueue?&transport.jms.DestinationType=queue"/>
</endpoint>
<inSequence>
<log level="custom">
<property name="STATE" value="message is sent to queue"/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
</inSequence>
<outSequence/>
</target>
</proxy>
my SOAP UI call
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.samples" xmlns:xsd="http://services.samples/xsd">
<soapenv:Header/>
<soapenv:Body>
<ser:dummy>
<xsd:symbol>IBM</xsd:symbol>
</ser:dummy>
</soapenv:Body>
</soapenv:Envelope>
According to doc I should see the message in JMS Message Broker BUT I get
Error while building Passthrough stream
TID[-1234] [ESB] [2017-05-16 12:52:47,137] ERROR {org.apache.synapse.transport.passthru.util.RelayUtils} - Error while building Passthrough stream org.apache.axiom.om.impl.builder.StAXOMBuilder.lookahead(StAXOMBuilder.java:711) org.apache.axiom.soap.impl.llom.SOAPBodyImpl.hasLookahead(SOAPBodyImpl.java:191) org.apache.axiom.soap.impl.llom.SOAPBodyImpl.getFirstElementLocalName(SOAPBodyImpl.java:217) org.apache.axiom.soap.impl.llom.SOAPBodyImpl.hasFault(SOAPBodyImpl.java:99) org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.hasFault(SOAPEnvelopeImpl.java:305) org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:189) org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:137) org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:100) org.apache.synapse.mediators.AbstractListMediator.buildMessage(AbstractListMediator.java:140) org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:83) org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59) org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158) org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:210) org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:403) org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151) org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745)
AND
Endpoint : AnonymousEndpoint with address jms:/myQueue?&transport.jms.DestinationType=queue will be marked SUSPENDED as it failed
First question :
java.naming.provider.url param in axis2.xml is it relative to [ESB Home] location ?
Im my case server folder structure looks like ...
maybe that should look like ....????
<parameter name="java.naming.provider.url" locked="false">file:/home/wso2admin/wso2esb-5.0.0/repository/conf/jndi.properties</parameter>
SECOND :
is this error related to Message Builder and Formater ????
any help would be nice ...couse Im stuck for days ...
First Question:java.naming.provider.url param in axis2.xml is it relative to [ESB Home] location ?
No, you dont need to add ESB home location.
Second Question: is this error related to Message Builder and Formater ????
Yes, you are getting an error with message builders.
Just verify whether you added client jars and verify your proxy. Please create a proxy as follow and try it.
Sample Proxy:
<proxy name="QueueProxy" startOnLoad="true" transports="jms">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<send>
<endpoint>
<address uri="jms:/MyQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=repository/conf/jndi.properties"/>
</endpoint>
</send>
</inSequence>
</target>
</proxy>
Reference: https://docs.wso2.com/display/ESB500/ESB+as+a+JMS+Producer
Please try the below proxy and check the URL format you are using
<proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" transports="http">
<target>
<inSequence>
<property action="set" name="OUT_ONLY" value="true"/>
<send>
<endpoint>
<address uri="jms:/myQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
for more
https://docs.wso2.com/display/ESB500/ESB+as+a+JMS+Producer
https://docs.wso2.com/display/MB310/Integrating+WSO2+ESB
Thanks to Rajjaz and Jan ...
I created a proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="SendMessagetoJMSProxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<log level="custom">
<property name="STATE" value="message is sent to myQueue"/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/>
</inSequence>
<outSequence/>
<endpoint>
<address uri="jms:/myQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=repository/conf/jndi.properties"/>
</endpoint>
</target>
<description/>
</proxy>
also I figure out that if you have define default JMS configuration part in axis2.xml for transportReceiver it is enough to put name of Queue
so this is also working
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="SendMessagetoJMSProxy2"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<log level="custom">
<property name="STATE" value="message is sent to GST_TMS_ASSOCIATE_LEASE Queue"/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/>
</inSequence>
<outSequence/>
<endpoint>
<address uri="jms:/myQueue"/>
</endpoint>
</target>
<description/>
</proxy>
and now I can publish a message to JMS queue with proxy ...
Im little confused (still) where all this log in System logs coming from and why ?!?]1

Send Mediator with VFS error WSO2 ESB

I create a proxy and sequence to read file from source folder then write it to target folder with send mediator with VFS. My Proxy look like this :
<proxy name="XXX" transports="vfs" startOnLoad="true" trace="disable">
<description/>
<target>
<inSequence>
<property name="filename"
expression="fn:concat(get-property('transport', 'FILE_NAME'), '')"/>
<sequence key="write"/>
<log level="custom">
<property name="finish" value="finish"/>
</log>
</inSequence>
</target>
<parameter name="transport.PollInterval">1</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///after</parameter>
<parameter name="transport.vfs.FileURI">file:///process</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
and my "write" sequence look like this :
<sequence name="write">
<property name="transport.vfs.ReplyFileName"
expression="get-property('filename')"
scope="transport"/>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint name="FileEpr">
<address uri="vfs:file:///Target"/>
</endpoint>
</send>
When I tried this proxy and sequence, the send mediator success to create a file in the "target" folder, but the problem is the content of the file is not written. So the size is 0 byte. My original file is 1000bytes. If I add this config in the sequence
<log level="full"/>
it works perfectly fine. My question is, do I need to use the log full config? but when I look at the File Processing sample in WSO2 web it doesn't use any log full config. So how can I use send mediator to write file without using any "log" property?
Thanks,

How to store the Messages In JMS Queue Using Wso2esb and Activemq

I am using wso2esb4.7.0 and ActiveMQ5.8.0 i wish to store the messages in Queue
for this i try with this code but its not working
i created store which will helpful for storing the messages,my conumeing process has done in JAVA code so i need not worry about the Consuming
if i do it my message will appear in acivemq UI
my config is like this
<messageStore name="JMSQueue" class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.destination">faisal5_Queue</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
</messageStore>
and i am trying to pass the message through the proxy for that i write simple proxy service for that
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Jms"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="messageType" value="application/json" scope="axis2"/>
<log level="full"/>
<property name="OUT_ONLY" value="true"/>
<store messageStore="JMSQueue"/>
</inSequence>
<outSequence/>
</target>
<description/>
</proxy>
in this case my queue is not creating in Activemq Why its happening
if i create message process then only my QUEUE is appearing in ActiveMQ UI
will you write sample code for this my scenario is simple i wsih to store my client messages without failure they will consume after the storing process
Your proxy and message store are okay, I tested those.
I think you have not correctly Configure the ESB with ActiveMQ.
Follow this link and place the jars as mentioned and edit the Axis2.xml. Then try with your code. It should work
You can simply use the below config to store messages in activemq.
Since you are not using a message processor, it is no need of making a message store. So you can simple store messages in the queue as follows.
<proxy name="JmsProxyTest"
transports="https http"
startOnLoad="true"
trace="disable">
<target endpoint="jmsEndpoint">
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
</inSequence>
<outSequence>
<drop/>
</outSequence>
</target>
<endpoint name="jmsEndpoint">
<address uri="jms:/faisal5_Queue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://127.0.0.1:61616&transport.jms.DestinationType=queue"/>
Also you better check you have configured activemq with esb correctly.
Thanks.

How we can process the Store and Forward Using JMS Message Stores

i have done all the changes in axis2 file and drop the jar files in lib
my message process is working fine and storing also
when ever i am sending request to proxy which consist store mediator and defined target.endpoint also after request message storing in message store its not processing
my configure files
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Message" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<property name="faisal" value="faisal" scope="default" type="STRING"/>
<property name="target.endpoint" value="JmsChecking" scope="default" type="STRING"/>
<store messageStore="faisal5"/>
</inSequence>
<outSequence>
<log level="full"/>
</outSequence>
</target>
<description></description>
</proxy
and message store is
<messageStore name="faisal5" class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.destination">faisal5_Queue</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
</messageStore>
and message processor
<messageProcessor name="faisal" class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor" messageStore="faisal5" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="interval">1000</parameter>
<parameter name="max.delivery.attempts">4</parameter>
</messageProcessor>
and endpoint define which is like this
and its entries
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="JmsChecking">
<address uri="http://localhost:8282/services/JmscheckingEndpoint" format="soap11">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
end point consist log values proxy
proxy xmlns="http://ws.apache.org/ns/synapse" name="JmscheckingEndpoint" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="custom">
<property name="Message" value="JMs working fine"/>
<property name="value" expression="//mail/text()"/>
</log>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description></description>
</proxy>
Now i am sending my request
this log value is printing like this
[2013-07-25 11:42:03,039] INFO - LogMediator Message = JMs working fine, value = faisal.shaik#youtility.in
[2013-07-25 11:42:03,039] INFO - LogMediator Message = JMs working fine, value = faisal.shaik#youtility.in
[2013-07-25 11:42:03,039] INFO - LogMediator Message = JMs working fine, value = faisal.shaik#youtility.in
[2013-07-25 11:42:03,039] INFO - LogMediator Message = JMs working fine, value = faisal.shaik#youtility.in
as well as message process is deactivating .if i am send one more request its just storing its not processing bcoz of message process is deactivate state
this JMS work only like this
MY scenario is i will get request if endpoint is available message will deliver and delete as well if endpoint is unavailable message will retry max mention times even also endpoint not available then it will store in message store
what is the use of this parameter will you please explain about this
i followed this link http://docs.wso2.org/wiki/display/ESB460/Store+and+Forward+Using+JMS+Message+Stores
where can i found this faisal5_Queue store point is it exist as folder
<parameter name="store.jms.destination">faisal5_Queue</parameter>
No it does not create a folder. when you mention the "store.jms.destination" using
faisal5_Queue wso2 esb will create an queue in your message broker(In your case ActiveMQ) with your specified name "faisal5_Queue". If you did not mention explicitly, WSO2 esb will create an queue with "YourMessageStoreName_Queue"
you can refer furthermore on these blogs to understand the behaviour of "Message Store" and "Message Processor"
http://vanjikumaran.blogspot.com/2013/08/jms-store-and-jms-processor-behavior.html
http://vanjikumaran.blogspot.com/2013/08/jms-messagenstore-and-jms-message.html
http://vanjikumaran.blogspot.com/2013/08/jms-messagen-store-and-jms-message.html