To build the JMS invocation sample, follow these steps:
Since we will use the same interface in two different projects, we put this interface into a library. Later, we will share this library for the two projects.
To create the library for the interface we want to share, complete the following steps:
The New Library window opens.
SharedInterface
.To create the new interface, complete the following steps:
The New Interface window opens.
bpc/samples
.MPGConverterProcess
.convert
.milesPerGallon
and the type from string to float.litresPer100KM
and the type from string to float.To create the new module, complete the following steps:
MPGConverter
.To create the new business process, complete the following steps:
The New Business Process window opens.
bpc/samples
.MPGConverterProcess
.Add a snippet activity
The Snippet activity is added.
Implement the snippet activity
System.out.println(">>>>>> *CHILD* Input: "+milesPerGallon+" milesPerGallon");
// some constants needed
float mile2km = 1.60934f;
float gallon2litre = 3.78541f;
// get value from Input message:
float mpg = milesPerGallon.floatValue();
// do the conversion
float kmPerGallon = mpg * mile2km;
float kmPerLitre = kmPerGallon / gallon2litre;
// initialize with "infinite" (fallback for div by 0)
float litresPerKM = 9999.999f; // poor man's infinite value
// if no div by zero, get the real value
if (kmPerLitre > 0) litresPerKM = 1/kmPerLitre;
// put result back to Output message
litresPer100KM = new Float(100 * litresPerKM);
System.out.println(">>>>>> *CHILD* Output: "+litresPer100KM+" litresPer100KM");
To create the new module, complete the following steps:
JMSInvoker
.To create the new business process interface, complete the following steps:
bpc/samples
.JMSInvokerProcess
.miles
and the type from string to float.gallons
and the type from string to float.litresPer100KM
and the type from string to float.To create the new business process, complete the following steps:
JMSInvoker
.bpc/samples
.JMSInvokerProcess
.Add a new variable
mpg
.f
in the Matching data types panel and click on float.Add a snippet activity
Prepare JMS call
.Finish the snippet activity
mpg = new Float(miles.floatValue() / gallons.floatValue());
System.out.println(">>> *PARENT* Input: "+miles+" miles out of "+gallons+" gallons");
System.out.println(">>> *PARENT* ... simplified to "+mpg+" mpg");
System.out.println(">>> *PARENT* ... now calling CHILD.");
Create Reference Partner
Add an invoke activity
Call converter process
.The invoke activity properties should now look like this:
Implement another snippet activity
Display result
.
System.out.println(">>> *PARENT* Output: "+litresPer100KM+" liters per 100 kilometers");
System.out.println(">>> *PARENT* ------------------------------------------");
Your business process should now look like this:
For the JMS invocation sample, we have to assemble two modules, the child module first.
To do this, complete the following steps:
The Configure JMS Export Service wizard opens:
Configure new messaging provider resources
.Serialized Java object (JMS)
.One operation function selector
, for the Function selector.SCA_Auth_Alias
.To do this, complete the following steps:
MPGConverterProcessExport
.Refer to the Run the Sample section on how to run JMSInvoker sample. For further information on using BPC Explorer refer to the product documentation.
If you want to run this sample business process on a WebSphere Process Server, you have to create two enterprise applications. Then you can install these enterprise applications to your WebSphere Process Server, the client Process first.
To create an enterprise application for the MPGConverterApp business process, follow these steps:
Note: If you do not have a WebSphere Process Server other than the one in the integrated test environment, you can skip this chapter.
The MPGConverterApp application is deployed and started now.
Install JMSInvokerApp in the same way. Additional details for install and hints for uninstall can be found in the HelloWorld sample.
Refer to the Run the Sample section on how to run the invoker process.