Tags

In this first part I want to demonstrate how we’re going to read a file from one directory to FileAdapter BPEL, then I will address as much as possible this wonderful component for file manipulation.

To have an example as practical as possible, I decided to create a post from and each part will be the evolution of the previous one, so if you want to follow and make the entire application is very important that you do or follow from the first part.

Here’s what I will demonstrate in the next Posts on FileAdapter:

Let’s start :-)

First, create a new still empty Project with FileAdapterBPEL name as follows:

Imagem Blog UansCarvalho

Drag a File Adapter component for Exposed Services and put the CapturaArquivo name and click Next

Imagem Blog UansCarvalho

In option below, leave checked the Define from operation and schema (specified later) and click Next

Imagem Blog UansCarvalho

Below select the Read File option and chooseo Do not read file content and click Next

Imagem Blog UansCarvalho

Now, select the Logical Name option and Directory for Incoming Files place the name FILE_IN

Note: In order for you to understand, we will further define the directory where the file is and move on to the File Adapter through this variable FILE_IN

Let marked the Process files recursively and other unmarked option and click Next

Imagem Blog UansCarvalho

Leave the File Wildcards option and Include Files with Name Pattern put the name arquivo.txt and click Next

Imagem Blog UansCarvalho

Below I set so that our directory is read at a frequency of 5 in 5 seconds, then click Next

Note: This is interesting you understand that our File Adapter will read the contents of the folder that will further define every 5 seconds, or will not read the same file again unless it is changed or that we put a new file.

Imagem Blog UansCarvalho

On the next screen click Finish

Imagem Blog UansCarvalho

Then, you will have a process as follows:

Imagem Blog UansCarvalho

Now click the right button on your composite.xml and click Generate Config Plan

Imagem Blog UansCarvalho

Click OK

Imagem Blog UansCarvalho

Open your file FileAdapterBPEL_cfgplan.xml and search by tag <service name=”CapturaArquivo”> and below, in <replace> place /home/uans/Arquivos (or as you want but remember to create this directories sequence in your home with the necessary permissions)

<service name=”CapturaArquivo”>
<property name=”FILE_IN”>
<replace>/home/uans/Arquivos</replace>
</property>
<binding type=”jca”/>
</service>

Imagem Blog UansCarvalho

Save the file and let us now to deploy your project but pointing to this directory using your Config Plan.

Right on top of your design click Deploy >> FileAdapterBPEL

Imagem Blog UansCarvalho

Click on Next

Imagem Blog UansCarvalho

On the screen below, click the plus sign + beside SOA Configuration Plan and select FileAdapterBPEL_cfgplan.xml and check the box below Overwrite any existing composites with the same revision ID and deselect Keep running instances on after redeployment and click Next

Imagem Blog UansCarvalho

Select the localhost option and click Next

Imagem Blog UansCarvalho

Click Next again

Imagem Blog UansCarvalho

Click Finish

Imagem Blog UansCarvalho

In the Deployment tab wait for your deployment has the message

—-  Deployment finished.  —-

Imagem Blog UansCarvalho

Now before we enter the directory and create a arquivo.txt, You will first enable trace and you’ll see an instance is created by putting the file.

In your browser go to the address http://localhost:10000/em

Note: The port 10000 is the number that chose to create my domain.

Login:

Imagem Blog UansCarvalho

Click on your project: FileAdapterBEL[1.0]

Imagem Blog UansCarvalho

Click on Settings >> Composite Audit Level and click Development, then click Yes

Imagem Blog UansCarvalho

Now go in the directory /home/uans/Arquivos and create a file called arquivo.txt

Imagem Blog UansCarvalho

Go back in EM (http://localhost:10000/em) and see that an instance is created, see also that he will be with status Running.

Imagem Blog UansCarvalho

In the next post we will enter information into this arquivo.txt eand we will read the contents of this file.

 

Doubts? Leave your comment and download this Projet :-)

 

Hugs and until the Next

/:-D