Thursday, 10 November 2011

HANDS On 2 : File Adapter , Business Rules Engine

Lets create one more simple BPEL process, which accepts user input based on same schema as the previous BPEL process, the Process would write into a File on /tmp Location every time the process gets executed
Open composite , Drag n drop a file adapter on External Reference , Connect the BPEL Process with File Adapter

Select File Write Operation

in the Physical path write down /tmp folder

Select the Jobs XSD

Open the BPEL process in the Edit Mode

Use Invoke activity to wire Invoke activity with the File Adapter

Use Assign Activity to Map input variable to File Adapter input variables

Testing the process

From the EM Test the process, you will see a new file created at /tmp location , with file name specified as jobs_sequence no . txt

Adding Business Rules

Lets add a simple Business Rule , Before actually writing into File Adapter

Drag n Drop Business Rule next to BPEL Process in the composite, connect BPEL process with the Rules Engine

Edit the Rules , lets create a simple rule if
if min salary is <= 3000 , lets send the response as salary rejected ,
if greater than 3000 salary is accepted ,
Edit the BPEL Process , add the Rules Engine before invoke of file adapter , Edit this to pass input parameter as process request , output as process response

Add a Switch case after execution of Rule , if the outcome is salary accepted , lets write the data into file adapter , else ignore it

Ensure that necessary parameters are passed into Rules Engine

In the switch case put the accepted condition as shown below, Deploy the Process and Test it

Conclusion : Any Min Salary greater than 3000 will be written into file system, less than 3000 will be ignored.

No comments:

Post a Comment