WSO2 inbound endpoint using registry entry - wso2

I am trying to set up an inbound endpoint in ESB 5.0.0. This works fine when setting a fixed value for the file uri. But i am not able to set this with a registry value.
In this question someone asked almost the same.
The answer is about setting <parameter name="transport.vfs.FileURI" key="conf:/repository/esb/esb-configurations/test"/>, but it does not explain what type of registry entry you need to have for a file endpoint.
Can someone give me a full explanation on how to set up a inbound endpoint with a fileuri that is defined in the registry?
The xml of the inbound endpoint
<?xml version="1.0" encoding="UTF-8"?>
<inboundEndpoint name="Poller.Label.Print.NL"
onError="FaultSequenceEmail" protocol="file" sequence="LabelPrint"
suspend="false" xmlns="http://ws.apache.org/ns/synapse">
<parameters>
<parameter name="interval">1000</parameter>
<parameter name="sequential">true</parameter>
<parameter name="coordination">true</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.LockReleaseSameNode">false</parameter>
<parameter name="transport.vfs.AutoLockRelease">false</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.FileURI">conf:/test</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///c:\tdemo\error</parameter>
<parameter name="transport.vfs.MoveTimestampFormat">yyyyMMddHHmmss</parameter>
<parameter name="transport.vfs.DistributedLock">false</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.dd</parameter>
<parameter name="transport.vfs.FileProcessInterval">10</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///c:\demo\archive</parameter>
<parameter name="transport.vfs.Locking">disable</parameter>
<parameter name="transport.vfs.FileSortAttribute">lastmodifiedtimestamp</parameter>
<parameter name="transport.vfs.FileSortAscending">true</parameter>
<parameter name="transport.vfs.CreateFolder">false</parameter>
<parameter name="transport.vfs.Streaming">true</parameter>
<parameter name="transport.vfs.Build">false</parameter>
</parameters>
</inboundEndpoint>
tested with the following xml, but did not work:
<?xml version="1.0" encoding="UTF-8"?>
<localEntry xmlns="ws.apache.org/ns/synapse" key="test">
file:///c:/demo/
</localEntry>

The file store in conf:/test need to have this content:
file:///c:\demo\
Check this:

Related

Specifying java.naming.provider.url for an inbound endpoint configuration in jndi.properties

I have an inbound endpoint configuration and I want to specify java.naming.provider.url value inside of the jndi.properties which will make me configure the inbound endpoint dynamically according to the provider urls of the different environments that I have.
Here is my axis2.xml configuration of ActiveMq
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">failover:tcp://localhost:6092</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
<parameter name="myQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">failover:tcp://localhost:6092</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.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">failover:tcp://localhost:6092</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
</transportReceiver>
and this is my inbound endpoint configuration:
<?xml version="1.0" encoding="UTF-8"?>
<inboundEndpoint name="inboundEP" onError="conf:sequences/om.esb/om.esb-faultSQ.xml" protocol="jms" sequence="inbEPSQ" suspend="false" xmlns="http://ws.apache.org/ns/synapse">
<parameters>
<parameter name="interval">1000</parameter>
<parameter name="sequential">true</parameter>
<parameter name="coordination">true</parameter>
<parameter name="transport.jms.Destination">example_request</parameter>
<parameter name="transport.jms.CacheLevel">3</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">conf/jndi.properties</parameter>
<parameter name="transport.jms.SessionAcknowledgement">AUTO_ACKNOWLEDGE</parameter>
<parameter name="transport.jms.SessionTransacted">false</parameter>
<parameter name="transport.jms.ConnectionFactoryType">queue</parameter>
<parameter name="transport.jms.ContentType">application/json</parameter>
<parameter name="transport.jms.SharedSubscription">false</parameter>
</parameters>
</inboundEndpoint>
In jndi.properties file, I tried to specify java.naming.provider.url in this way:
# register some connection factories
# connectionfactory.[jndiname] = [ConnectionURL]
connectionfactory.QueueConnectionFactory = amqp://admin:admin#clientID/carbon?brokerlist='tcp://localhost:5675'
connectionfactory.TopicConnectionFactory = amqp://admin:admin#clientID/carbon?brokerlist='tcp://localhost:5675'
java.naming.provider.url=failover:tcp://localhost:6092
# register some queues in JNDI using the form
# queue.[jndiName] = [physicalName]
queue.MyQueue = example.MyQueue
# register some topics in JNDI using the form
# topic.[jndiName] = [physicalName]
topic.MyTopic = example.MyTopic
but in WSO2 console, I have the following error:
Could not create Transport. Reason: java.io.IOException: Transport not scheme specified: [conf/jndi.properties]
Thanks for any idea!
As the name suggests 'java.naming.provider.url' should be a URL, so something starting with '(protocol)://'
Since tcp://localhost:6092 worked for you in your other configuration, try this instead:
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:6092</parameter>
What happens in JNDI is that first your "java.naming.factory.initial" class is created (which is org.apache.activemq.jndi.ActiveMQInitialContextFactory in your case) and then you can use any of the provider urls supported by this class. Depending on your provider it could support different URL types (tcp:, file:, ssl:, ...). ActiveMQ supports vm: and tcp: - when specifying tcp: it will load this JNDI configuration using TCP from that broker.

WSO2 VFS parallel processing

I'm using WSO2 ESB to process files: an inbound-endpoint with polling, detect a file and pass it to a sequence. That sequence read the file and process records (writing to database).
My question is about processing multiple files at once.
For now I have this configuration:
<?xml version="1.0" encoding="UTF-8"?>
<inboundEndpoint name="AssuresContratsGtIEP" onError="TechnicalExceptionSEQ" protocol="file" sequence="AssuresContratsGtSEQ" suspend="false" xmlns="http://ws.apache.org/ns/synapse">
<parameters>
<parameter name="interval">5000</parameter>
<parameter name="sequential">true</parameter>
<parameter name="coordination">true</parameter>
<parameter name="transport.vfs.FileProcessCount">2</parameter>
<parameter name="transport.vfs.ContentType">application/binary;charset=UTF-8</parameter>
<parameter name="transport.vfs.LockReleaseSameNode">false</parameter>
<parameter name="transport.vfs.AutoLockRelease">false</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.FileURI">/home/istya/Flux/REF_PERS/Input/</parameter>
<parameter name="transport.vfs.MoveAfterFailure">/home/istya/Flux/REF_PERS/Failure/</parameter>
<parameter name="transport.vfs.DistributedLock">false</parameter>
<parameter name="transport.vfs.FileNamePattern">.*ASSURES_CONTRATS_GT.*.csv</parameter>
<parameter name="transport.vfs.MoveAfterProcess">/home/istya/Flux/REF_PERS/Process/</parameter>
<parameter name="transport.vfs.Locking">disable</parameter>
<parameter name="transport.vfs.FileSortAttribute">none</parameter>
<parameter name="transport.vfs.FileSortAscending">true</parameter>
<parameter name="transport.vfs.CreateFolder">true</parameter>
<parameter name="transport.vfs.Streaming">true</parameter>
<parameter name="transport.vfs.Build">false</parameter>
</parameters>
</inboundEndpoint>
When I change the sequential parameter to "false", the program crashes: first mediator on the sequence says that the file does not exist (although the file is still in the polling folder...).
Does anyone knows how to process multiple files with the same inbound and sequences in WSO2 ESB ? Is it possible or do we need to install a cluster of ESB ?
Thanks for your support !
Julien

WSO2 - EI 6.2.0 - Configuring Oracle AQ JMS database with EI to publish/consume messages to/from Oracle AQ JMS

This is Radhakrishnan and new to WSO2 world. Would like to configure the Oracle AQ JMS with EI so that EI can consume/publish messages from Oracle AQ JMS.
Configuration for axis2.xml has been done and written a Proxy to consume message from Oracle AQ JMS.
Now when we are publishing to Oracle AQ JMS we are getting below error and anybody has suggestion/valuable inputs?
Caused by: javax.naming.NameNotFoundException: Name [dynamicQueues//RIB_AQ_USER.ETEXTPAYTERM] is not bound in this Context. Unable to find [dynamicQueues].
at org.apache.naming.NamingContext.lookup(NamingContext.java:825)
at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
at org.wso2.carbon.context.internal.CarbonContextDataHolder$CarbonInitialJNDIContext.lookup(CarbonContextDataHolder.java:709)
Here is the code snippet:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="RMSPayTermOutToRMSProxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<log level="full"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/>
<send>
<endpoint>
<address format="pox"
uri="jms2:/RIB_AQ_USER.ETEXTPAYTERM?transport.jms.ConnectionFactoryJNDIName=JMSSenderTopicConnectionFactory"/>
</endpoint>
</send>
</inSequence>
</target>
<parameter name="serviceType">proxy</parameter>
<description/>
</proxy>
I have faced a similar problem a year ago, and we fixed using the below configurations.
We have configured the Connection Factory(AqQueueConnectionFactory) in axis2.xml
<!-- Oracle AQ Listener Start-->
<transportReceiver name="oracleaq" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="AqQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">oracle.jms.AQjmsInitialContextFactory</parameter>
<parameter name="db_url" locked="false">jdbc:oracle:thin:#hostname:port:schema</parameter>
<parameter name="java.naming.security.principal" locked="false">username</parameter>
<parameter name="java.naming.security.credentials" locked="false">password</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="AqTopicConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">oracle.jms.AQjmsInitialContextFactory</parameter>
<parameter name="db_url" locked="false">jdbc:oracle:thin:#hostname:port:schema</parameter>
<parameter name="java.naming.security.principal" locked="false">username</parameter>
<parameter name="java.naming.security.credentials" locked="false">password</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
</transportReceiver>
<!-- Oracle AQ Listener End -->
We have to restart the server after changing the axis2.xml and adding the following jar file (aqapi-10.1.3.1.jar and its dependencies) in the lib folder.
In the Proxy, Parameters section, we defined the Queue configuration to which the Proxy listens to.
<parameter name="transport.jms.DestinationType">queue</parameter>
<parameter name="transport.jms.Destination">Queues/QueueName</parameter>
<parameter name="transport.jms.ContentType">
<rules xmlns="">
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parameter name="transport.jms.ConnectionFactory">AqQueueConnectionFactory</parameter>
AS stated above in the axis2.xml, we enabled the oracleaq as one if the transport of the proxy.
Once the above setup is done, we can listen to the queues/topics from Oracle AQ without any issues.
Thanks.

Messages are vanishing after restarting WSO2 Server

I am using WSO2 ESB 5.0.0 and Apache activeMQ 5.14 for my project.I am using jms proxy which is listening to a queue and the proxy is using jms message store to store the messages.And there is a message processor which will pick up those messages from that message store for further processing.
But after restarting WSO2 server the messages which were stuck at the queue are getting dequeued and vanished.
Is there any way to store those messages by WSO2?
Here is my proxy service:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="abcMQ"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="jms">
<target>
<inSequence>
<log level="full" separator="**Consumed from abc IN Seq**"/>
<property name="DISABLE_CHUNKING"
scope="axis2"
type="STRING"
value="true"/>
<store messageStore="TEST"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</target>
<parameter name="transport.jms.Destination">req.Q</parameter>
<parameter name="transport.jms.ContentType">application/XML</parameter>
<description/>
</proxy>
The message store TEST is below:
<messageStore name="TEST" class="org.apache.synapse.message.store.impl.jms.JmsStore" 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">TEST.Q</parameter>
<parameter name="store.jms.username">admin</parameter>
<parameter name="store.jms.password">admin</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.producer.guaranteed.delivery.enable">true</parameter>
<parameter name="store.failover.message.store.name">fail</parameter>
</messageStore>
The fail message store is:
<messageStore name="fail" class="org.apache.synapse.message.store.impl.jms.JmsStore" 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">fail.Q</parameter>
<parameter name="store.jms.username">admin</parameter>
<parameter name="store.jms.password">admin</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.producer.guaranteed.delivery.enable">false</parameter>
<parameter name="store.failover.message.store.name">fail</parameter>
</messageStore>
Message processor is:
<messageProcessor name="TestProcessor" class="org.apache.synapse.message.processor.impl.sampler.SamplingProcessor" messageStore="TEST" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="interval">1000</parameter>
<parameter name="concurrency">1</parameter>
<parameter name="sequence">DemoSequence</parameter>
<parameter name="is.active">true</parameter>
</messageProcessor>
Since the in-memory message stores uses an in-memory queue to store the messages, the messages will be lost in case of a restart or shutdown.
That's why its use is not recommended for Production systems or large scale message processing systems. You can view the recommendation here.
Consider using other forms of message stores for better reliability and guaranteed delivery. Refer the following options:
https://docs.wso2.com/display/ESB500/Adding+a+Message+Store
Also consider using a fail-over message store for better reliability.
https://docs.wso2.com/display/ESB500/Guaranteed+Delivery+with+Failover+Message+Store+and+Scheduled+Failover+Message+Forwarding+Processor

How to bypass ActionAfterProcess for 0 sized file in wso2 esb

I am using below configuration to move files from one folder to another.But I dont want to move or delete the files of 0 size in "in" folder.pls help me.
<parameter name="transport.vfs.ReplyFileURI">vfs:file://E:\\orders</parameter>
<parameter name="Operation">urn:saveOrder</parameter>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///E:\out</parameter>
<parameter name="transport.vfs.FileURI">file:///E:\in</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///E:\fails</parameter>
<parameter name="transport.vfs.FileNamePattern">.*\.xml</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
Don't use ActionAfterProcess
Inside your inSequence, use send mediator to write the file to your destination :
<send>
<endpoint>
<address uri="file:///E:\out"/>
</endpoint>
</send>
Use filter mediator to decide if this send must be executed or not, depending on the value of FILE_LENGTH : get-property('transport','FILE_LENGTH')