>

Saturday, December 5, 2015

WSO2 ESB - Using File Inbound endpoint

With WSO2 ESB 4.9.0 you can use different Inbound endpoints. ESB has 3 types of inbound endpoints;
  • Listening Inbound Endpoints
  • Polling Inbound Endpoints
  • Event-Based Inbound Endpoints

In this blog post I'll explain how to create a file inbound endpoint.
File Inbound endpoint falls under Polling Inbound Endpoints. 

  1. Start ESB server.
  2. Go to Inbound Endpoints.
  3. Provide a name and select type as File. Click next.
  4. Provide and save the details here.


Sequence is the name of the sequence which should be called once a file is read from the location specified in transport.vfs. FileURI. You can read more on vfs parameters from [1]

Sample inbound endpoint configuration looks like follows,

<?xml version="1.0" encoding="UTF-8"?>
<inboundEndpoint xmlns="http://ws.apache.org/ns/synapse"
name="vfsEndpoint"
sequence="inboundtest"
onError="fault"
protocol="file"
suspend="false">
<parameters>
<parameter name="interval">60</parameter>
<parameter name="transport.vfs.ActionAfterErrors">NONE</parameter>
<parameter name="coordination">true</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.LockReleaseSameNode">false</parameter>
<parameter name="transport.vfs.AutoLockRelease">true</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.AutoLockReleaseInterval">5000</parameter>
<parameter name="transport.vfs.CreateFolder">true</parameter>
<parameter name="sequential">true</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.FileURI">file:///home/sachini/dev/inbooundtest</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///home/sachini/dev/inbooundtest/error</parameter>
<parameter name="transport.vfs.DistributedLock">false</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///home/sachini/dev/inbooundtest/out</parameter>
<parameter name="transport.vfs.Locking">enable</parameter>
<parameter name="transport.vfs.FileSortAscending">true</parameter>
<parameter name="transport.vfs.FileSortAttribute">NONE</parameter>
</parameters>
</inboundEndpoint>



Once you add the inbound endpoint and put a file (in this case a xml file) in the location specified in transport.vfs.FileURI. File will be read and the specified sequence will be called.