The savings account assembly diagram is modified to include an extra import binding, CurrentAccountRequest, that is used to make a call to the broker message flow that is hosting the current account.
The business process is also amended to reflect this current account and initiates a transfer only if sufficient funds are available.
The key differences between this extended application and the simple one are:
The current account is hosted on WebSphere Message Broker as a message flow that comprises the two subflows and the following nodes:
The SCAInput node in the message flow receives the message that contains the operation to be performed, for example, debit or credit, and the amount to transfer. Depending on whether the amount is to be credited or debited, the message is propagated, by using the appropriate dynamic terminal, to either the CurrentAccountDebit or CurrentAccountCredit subflow.
Both subflows contain JavaCompute nodes:
If the incoming message request is an instruction to debit the current account, the transfer amount is subtracted from the current account balance. If the result is less than zero, the previous balance is propagated by using the local environment and a response message is created, which states that the transaction is not authorized. If the result is greater than or equal to zero, the new balance is propagated by using the local environment and a response message is created that authorizes the transaction.
If the incoming message request is an instruction to credit the current account, the transfer amount is added to the current account balance. The new balance is propagated by using the local environment and a response message is created that authorizes the transaction.
The response message is sent back to the caller, WebSphere Process Server, at the SCA Reply node.