Here is a simple example of using the above -
I have a web service that checks the inventory status of products.
I create a BPEL process that accepts an order as input and then calls the above web service to get the
inventory status of the product.
I deploy and test.
I will now leverage Coherence to store the Inventory Status.
There will be 2 operations - Put and Get that will need to be supported.
Defining the Get adapter
Defining the Put adapter
Amend the BPEL process to leverage the Coherence adapters
Edit the Invoke activity and add the following property -
This will populate the product variable value into the property
and then pass it on the invocation to the adapter.
Now I add an If branch after this, checking if the value is in the cache.
Rename the labels
If in the cache, simply assign the cached value to the output
If not, then call the web service to get the inventory status.
Then store the result in the coherence cache.
Do not forget to edit the Invoke of the Put, to add the jca.coherence.key value
Deploy and test
The first test, and the cache is empty -
Now, I re-test with the same product -
JDev project here
I have a web service that checks the inventory status of products.
I create a BPEL process that accepts an order as input and then calls the above web service to get the
inventory status of the product.
I deploy and test.
I will now leverage Coherence to store the Inventory Status.
There will be 2 operations - Put and Get that will need to be supported.
Defining the Get adapter
Defining the Put adapter
Amend the BPEL process to leverage the Coherence adapters
Edit the Invoke activity and add the following property -
This will populate the product variable value into the property
and then pass it on the invocation to the adapter.
Now I add an If branch after this, checking if the value is in the cache.
Rename the labels
If in the cache, simply assign the cached value to the output
If not, then call the web service to get the inventory status.
Then store the result in the coherence cache.
Do not forget to edit the Invoke of the Put, to add the jca.coherence.key value
Deploy and test
The first test, and the cache is empty -
Now, I re-test with the same product -
JDev project here
No comments:
Post a Comment