I think you are familiar with connector, streaming and VFS transfer. If not please refer my previous blogs. As I mentioned in the previous blog we can do the vfs sending feature by using file connector and file inbound. File connector is quite simple to use compared to the vfs sender for various file operations. Before that we will get some knowledge about inbound.
Brief intro to inbound endpoint
Inbound is a feature in WSO2 ESB. An inbound endpoint is a message entry point that can inject messages directly from the transport layer to the mediation layer, without going through the Axis engine. The following diagram illustrates the inbound endpoint architecture. For proxy, we have to invoke it. but a inbound can be invoked by itself. There are three types of inbounds in WSO2 ESB.
- Listening Inbound Endpoint: A listening inbound endpoint listens on a given port for requests that are coming in. When a request is available it is injected to a given sequence.
- Polling Inbound Endpoint: A polling inbound endpoint polls periodically for data and when data is available the data is injected to a given sequence.
- Event based Inbound Endpoint: An event-based inbound endpoint polls only once to establish a connection with the remote server and then consumes events.
- File Inbound Protocol
- JMS Inbound Protocol
- Kafka Inbound Protocol
The WSO2 ESB file inbound protocol is a multi-tenant capable alternative to WSO2 ESB VFS transport. In previous post we got the idea about VFS transport. Same functionality can be done through file inbound. we can specify streaming facility in WSO2 ESB 5.0 in file inbound. For Streaming we have to add message builder and formatter in the
<ESB_HOME>/repository/conf/axis2/axis2.xml
file.- Add <messageFormatter contentType="application/file"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/> under the message formatters. - Add <messageBuilder contentType="application/file"
class="org.apache.axis2.format.BinaryBuilder"/> under the message builders.
Steps
- Start ESB 5.0 by going to <ESB_HOME>/bin.
- You can get file connector from the store (https://store.wso2.com/store/assets/esbconnector/aec1554a-29ea-4dbb-b8c5-5d529a853aa2).
- Add the connector by going to Connectors->Add in WSO2 ESB management console and browse connector zip file and enable it.
- Go
to Service bus-> sequence in ESB management console and add
following lines in source view to specify the connector configuration.
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse">
<property name="OUT_ONLY" value="true"/>
<property action="remove" name="ClientApiNonBlocking" scope="axis2"/>
<fileconnector.send>
<address>file:///xxx/xxx/Desktop/testESB/OutTest</address>
<append>true</append>
</fileconnector.send>
<drop/>
</sequence>
Here we specify the where do we want to send the file in address. Then save this sequence in registry. - Then go to Service bus->Inbound Endpoints-> Add Inbound Endpoint. After that specify the name and select Type as File. Then press next. In next window you have to specify sequence. u already saved your sequence in registry. Then you can select configuration registry. Then you will get following window and select your sequence.
- When you put a file in the fileURI location, you can see the response file in the address location you specified.
This blog is very helpful and informative for this particular topic. I appreciate your effort that has been taken to write this blog for us. Transfer File
ReplyDelete