The SCA Nodes sample consists of two message flows which:
The extended sample features an extra message flow which:
The following overview diagram shows the relationships between the message flows on WebSphere Message Broker and the business process on WebSphere Process Server.
This simple message flow comprises the following nodes:
The broker receives a request in the form of a URI from a browser client by using the HTTP transport.
The JavaCompute node:
From the browser client, choose the type of transfer request, enter the amount of money to transfer, click Submit.
Submitting the form posts these property values, by using HTTP, to another message flow listening on the HTTP port.
This message flow comprises the following nodes:
The message flow receives the property values as MIME message parts.
A JavaCompute node processes these property values by creating a XML request message from the amount and overriding the Local Environment SCA operation with the transfer request type.
The request identifier is copied to the user context so that it is not lost when the response message arrives at the SCA Asynchronous Response node. This identifier is required to reply back to the originating client.
The transfer can also be validated at this stage. If an invalid or blank amount is specified, an MbUserException is generated. If validation fails, the user exception is propagated through the Failure terminal. The exception message is included in a reply message to the originating client. Click OK to be routed back to the bank transfer form so that a correct amount can be specified.
If validation is successful, the XML transfer request message is propagated to an SCAAsyncRequest node. This node sends the message to the specified SCA service that is hosted by WebSphere Process Server. This SCA service contains the business logic related to savings account processing.
After the request has been processed, an XML transfer response message is sent back to WebSphere Message Broker where it is processed by the corresponding SCAAsyncResponse node. If the bank transfer request was successfully processed, the new savings balance is included in the reply message. If the bank transfer request was unsuccessful, the previous savings balance is used.
The request identifier is also retrieved from the local environment and copied to the Destination folder so that the reply message can be sent back to the originating client.
The savings account is hosted on WebSphere Process Server. It comprises:
These components are connected in an assembly diagram:
The implementation of the business process is split into two parts corresponding to the two operation requests:
If the incoming XML message request is to transfer to the savings account, the business process variables are initialized from this message. The savings balance is read from a file by using a Java interface and credited by the requested amount. This new balance is then written back to the file by using the Java interface, a message response is created with the relevant values filled in from the business process variables and sent back to the caller.
If the incoming XML message request is to transfer to the current account, the business process variables are initialized from this message. The savings balance is read from a file by using a Java interface and debited by the requested amount. If the new balance is greater than or equal to zero, the new balance is written back to the file by using the Java interface. If the new balance is less than zero, the previous balance remains in the file. A message response is created with the relevant values filled in from the business process variables and sent back to the caller.