(Sending text message in ftp files)
This blog shows you step by step approach to create a FTPBC application with Logicoy OpenESB 2.3 IDE. Tutorial only explains the basics of creating a new project that uses basic FTPBC functionality. We suppose you already have Logicoy OpenESB IDE on your system. If you have not installed Logicoy OpenESB 2.3, please install using following links.
Get the latest binary as per your system requirement. Follow the OpenESB 2.3 Installation Guide for further installation assistant.
To start, open the Logicoy OpenESB IDE from your installed location.
Select New project from File->New Project
Click Next from the above dialogue box after selecting BPEL Module.
Enter Project Name [FTPBCDemoBPEL] , select appropriate project location, then click on Finish.
Select File -> New Project Or Right click on Project Explorer and select New Project
Enter Project Name [FTPBCDemoCompApp], Click on Finish. You can see now two projects created on project explorer.
Step-1 : Create new WSDL Document by right click on Process Files under BPEL Module.
Now enter WSDL name as [triggerBPEL], as shown below.
Select WSDL type as Concrete WSDL Document, and select Binding as SCHEDULER, and leave default binding type static. Click Next
Now you need to create new trigger. In Scheduler BC, there are two type of trigger, Simple and Cron. Simple trigger executes as per some static time interval, for example after every 5 min / 1 day etc. We just need to give the time interval and repeat value, that specify number of time scheduler will fire. Cron trigger executes in specific time configured in WSDL. For now compare it with the crontab in linux. For example we want to fire trigger in every mid night 1:00 AM. For this project we are going to create Simple trigger. Click on + sign to add simple trigger as shown below.
Enter trigger Name, Description and interval in Seconds, and Message that trigger will send to BPEL module.
Click on finish to complete the WSDL creation.
You can see difference in generated source code of WSDL document. Remember interval we given 5 seconds, that is converted to 5000 milliseconds. As shown below
Right click on process files and select BPEL process
Enter new BPEL process file name as FTPBCDemo, and click on finish.
Here we will create new WSDL document of type FTP as shown below. Select the binding type as Send Request. Click on next
Give the FTP configuration as shown below. Enter FTP host name, FTP user, FTP Password, Leave the document style as UNIX. Click on next
Enter valid Remote file path where message will be written. Select Post send command as Rename, that will move the remote file in other FTP location. Don’t forget to give %u in file name given in location. Also select check box that shows the file name is a pattern file name. %u specifies that the File name will be UUID that will work with JDK 1.5 + versions. Match your entries with following dialogue box.
Click on finish to complete FTP WSDL creation.
Now we will start defining our BPEL process. At first drag the triggerBPEL WSDL file in left side of your BPEL process file. Give the partner link name as triggerBPELLink.
Drag Receive operation from palette as shown below.
At first this operation will show error mark because this is not yet join to any partner link.
To remove the error, double click on Receive1 operation.
Select triggerBPELLink from partner Link select box. Select Operation FireTriggerOperation.
Click on create button to create new input variable, that will store the Message send from scheduler. We will use this message to send in FTP files.
As you can see in below dialogue box, Error is gone
Now drag the FTP WSDL, in right hand side of the BPEL process. As shown below. Give the partner link name as invokeFTPLink.
Drag Assign and Invoke Element from the palette.
Double click on Invoke1 element. And select partner Link invokeFTPLink and Operation OutboundOneWayTransferringOperation. Click on create button to create new inputVariable.
Now Double click on Assign1 Element that will open Mapping view in BPEL process. Do the mapping as shown below
Note that all errors should go off and you will see following final BPEL process view.
Expand the FTPBCDemoCompApp Project and open the Service Assembly, There is nothing added for now.
To add the BPEL module here, drag the BPEL Project as shown below.
Now BPEL Module is added in your CompApp.
Now build the CompApp project, the file will look like follows.
To deploy the comp app in glassfish server, select composite application right click and select deploy
As soon as the project is deployed in Glasshfish server. Scheduler BC fires trigger in every 5 seconds that results new file created in FTP locations in every 5 seconds as shown below.
Open the file to see the message. Note this message we configured in scheduler BC. This is a simple Text Message, which can be modified anytime, during BPEL Process.
I hope this tutorial will help you to get start with simple FTP Operation in Logicoy OpenESB 2.3. In Next tutorial I will discuss about FTPBC with the File Operation, where we can send a complete file directly in FTP Message Repository.