Showing posts with label BPEL. Show all posts
Showing posts with label BPEL. Show all posts

Tuesday, November 23, 2010

When to use OSB & BPEL?

Use OSB for:
  • Endpoint routing (providing location transparency) so that we do not care about the physical location of the endpoint.
  • Endpoint abstraction (interface transparency) so that we do not care about the exact data formats required by the endpoint because the OSB will take care of transformations.
  • Load balancing so that we do not care about which of multiple service implementations will actually service a request. 
  • Throttling so that we do not care about how use of services is restricted.  
  • Enrichment so that we do not care about how additional data is provided to the request to match the expected request and response formats.
  • Simple synchronous composition so that we do not care if our abstract service call is actually made up of two or more physical service calls.
  • Protocol conversion so that we do not care what physical transports are being used.
  • Sync/async abstraction so that we can treat services as fire and forget or query response according to the needs of the client.

Use BPEL for:
  • Complex composition of parallel flows that involve more than a couple of services.
  • Long running compositions that may run for minutes, hours or days.
  • Asynchronous compositions that require correlation of requests and responses.
  • Process abstraction that enables us to track processes and their interactions with multiple services.
  • Human workflow
Related blog topics:

Sunday, November 21, 2010

Exposing Ora BPEL processes as Web services in OSB layer

With Oracle Service Bus's native transport for Oracle BPEL Process Manager (BPEL transport), you can expose BPEL processes as Web services in the service bus layer, letting other services invoke BPEL processes; thus letting you include BPEL processes in your service oriented architecture (SOA).
 Communication between Oracle BPEL Process Manager and Oracle Service Bus is done over SOAP only. OSB and Oracle BPM do not provide full support for SOAP RPC encoding.
  • SOAP 1.1. SOAP 1.2 is supported only from Oracle Service Bus to Oracle BPEL Process Manager using synchronous communication.
  • SOAP headers

BPEL transport has the following restrictions:
  • No attachments
  • No WS-Security or WS-RM
Oracle BPEL Process Manager supports transaction propagation through its API, and the BPEL transport is transactional to support transaction propagation when Oracle BPEL Process Manager is deployed on Oracle WebLogic Server. For example, if a process begins in a service outside of Oracle BPEL Process Manager, Oracle Service Bus can propagate the transaction to Oracle BPEL Process Manager through the BPEL transport to complete the transaction.

Communicating to and fro Oracle BPEL Process Manager through Oracle Service Bus
1. Synchronous: Invoking Processes in Oracle BPEL Process Manager
Description of Figure 34-1 follows
  a. Create a Business Service in Oracle Service Bus that represents the BPEL process you want to invoke.
  • Create a WSDL-based business service. Generate the WSDL from Oracle BPEL Process Manager.
  • Select the bpel-10g transport in the business service configuration.
  • Set the Endpoint URI
  • Configure the remainder of the business service

  b. Create a Proxy Service in Oracle Service Bus that invokes the business service

 2.  Synchronous: Calling External Services from Oracle BPEL Process Manager
Description of Figure 34-2 follows
  • Create a Business Service in Oracle Service Bus that represents the external service you want to invoke
  • Create a Proxy Service in Oracle Service Bus that invokes the business service.
    • You must create the proxy with a SOAP WSDL to invoke the business service.When defining your proxy service, for the Service Type select WSDL Web Service, and select the desired port or binding.
    • Select the sb transport in the proxy service configuration.
    • To invoke the proxy service from Oracle BPEL Process Manager, export the proxy service's effective WSDL and import it into your Oracle BPEL Process Manager development environment. Invoke the proxy service from Oracle BPEL Process Manager as you normally would.
 3. Asynchronous: Invoking Processes in Oracle BPEL Process Manager
Description of Figure 34-3 follows
  • Create two proxy services in Oracle Service Bus: one that invokes the business service and another that handles the callback.
    Request Proxy Service
    • Since the callback will be sent on a different connection in asynchronous communication, you must establish the callback address in the request proxy. This callback address will be passed to the callback proxy and callback business services so that the message is sent back to the correct client.
      As part of the business service configuration, you select a Callback Proxy. At run time, the BPEL transport uses this proxy as the callback proxy.
      For approaches to setting a callback address if you do not select a callback proxy in the business service
    Callback Proxy Service
    • Configure the proxy to use a Service Type of WSDL SOAP or Any SOAP Service and the SB or HTTP transport. Use the SB transport if you want transaction propagation from Oracle BPEL Process Manager to Oracle Service Bus.
      If you select this proxy service as the business service's callback proxy, the BPEL transport provides the correct callback URI at run time.
  • Create two business services in Oracle Service Bus: one that makes the request to the Oracle BPEL Process Manager process you want to interact with and another that handles the callback.
    Request Business Service
    • Create a WSDL-based business service. Generate the WSDL from Oracle BPEL Process Manager. Select a Service Type of WSDL Web Service, and select the appropriate binding or port in the WSDL.
    • Select the bpel-10g transport in the business service configuration.
    • Set the role to Asynchronous Client.
    • Set the Endpoint URI.
    • Use the Callback Proxy field on the bpel-10g transport configuration page to select the callback proxy you created.
    Callback Business Service
    Configure the business process you need to handle the callback.
 4. Asynchronous: Calling Service Providers from Oracle BPEL Process Manager

Description of Figure 34-4 follows

Creating and Configuring the Services

  • Create two proxy services in Oracle Service Bus: one for the request that invokes the business service and another that handles the callback.
    Request Proxy Service
    • Configure the proxy service to use the sb transport.
    • Since the callback will be sent on a different connection in asynchronous communication, you must establish a callback address so that the message is sent back to the correct client.
    Callback Proxy Service
    • Configure the proxy service to pass the callback address to the business service. The callback URI is provided in the request. Use URI rewriting to extract the callback URI and forward it to the business service.
  • Create two business services in Oracle Service Bus: a request business service that invokes the external service and a callback business service.
    Request Business Service
    • Configure the business service to invoke the external service.
    Callback Business Service
    • The callback business service receives the callback address from the callback proxy. The URI rewriting performed by the callback proxy service determines which BPEL process to send the response to.
      Create a WSDL-based business service. Generate the WSDL from Oracle BPEL Process Manager. Select a Service Type of WSDL Web Service, and select the appropriate binding or port in the WSDL
    • Select the bpel-10g transport in the business service configuration.
    • Set the Endpoint URI to bpel://callback. The callback URI is provided by the callback proxy service.
    • Set the role to Service Callback on the bpel-10g in transport configuration tab

Note:
If the callback address is always known, for example when the client and BPEL service are linked together because of a trading partner agreement, you can provide the exact callback address in the callback business service instead of using bpel://callback.
BPEL thru OSB: Associating messages with correct conversation


Refer:
Ora BPM thru OSB
Calling BPEL from OSB - good one 
Asynchronous BPEL to BPEL Through Oracle Service Bus Example
WS-Addressing Reference
Working with Proxy Services
Asynchronous BPEL to BPEL Through Oracle Service Bus Example
Setting a callback address
Working with Proxy Services

Other related topics:

Ora BPEL thru OSB - associating message with correct conversation

Associating Messages with the Correct Conversation
When using stateful services, the messages sent synchronously between Oracle Service Bus and Oracle BPEL Process Manager are known as a conversation. Oracle BPEL Process Manager supports the following mechanisms for ensuring that messages are correctly associated with each other as part of a conversation. These mechanisms are independent of each other, and you may choose to use both to ensure correct association.
  • BPEL Correlation – BPEL correlation is part of the BPEL specification. When a WSDL-based business service in Oracle Service Bus sends a message to a BPEL process, the BPEL engine examines the message to find the target BPEL process instance.
  • Opaque Correlation using WS-Addressing – When a conversation is initiated by a client through Oracle Service Bus to a BPEL process, the BPEL engine looks in the WS-Addressing SOAP header for the "messageID" value to use as the ID for the new conversation. The conversation ID is carried through the conversation as the "RelatesTo" value.
 "MessageID" and "RelatesTo" are used to store the conversation ID in conversations between Oracle Service Bus and Oracle BPEL Process Manager, making sure related messages remain in the same conversation.
The BPEL transport does not let you specify whether a given operation is a start or continue operation. Instead, the BPEL transport looks for the "MessageID" and "RelatesTo" properties and sets them accordingly.
The following describes how the BPEL transport uses "MessageID" and "RelatesTo" in synchronous and asynchronous conversations:
  • Synchronous conversation: In the initial request, the "MessageID" determines the conversation ID. In the remaining communication, the BPEL transport provides the conversation ID as the RelatesTo value.
    If there is no value assigned to "MessageID" or "RelatesTo," the transport assumes either no conversation is occurring or that Oracle BPEL Process Manager is handling the correlation.
  • Asynchronous callbacks - In the initial request, the "MessageID" determines the conversation ID. In the remaining communication, the BPEL transport provides the conversation ID as the "RelatesTo" value in the callback.
    If there is no value assigned to "MessageID" or "RelatesTo," the transport assumes either no conversation is occurring or that Oracle BPEL Process Manager is handling the correlation.
Refer:

Correlation illustrated


Related blogs

Oracle BPEL PM - Dehydration Store?

BPEL is the standard for assembling a set of discrete services into an end-to-end process flow, radically reducing the cost and complexity of process integration initiatives. BPEL is an OASIS standard executable language for specifying actions within business processes with web services. Processes in Business Process Execution Language export and import information by using web service interfaces exclusively. Leaders in this arena include Oracle BPEL PM, Websphere PM etc.

Oracle BPEL PM utilizes a database to store metadata and instance data during runtime. The process of updating process state in the database is called Dehydration. This data is stored in what is known as the Dehydration store, which is simply a database schema (also called dehydration store, BPEL schema, BPEL tables). The Dehydration Store database is used to store process status data, especially for asynchronous BPEL processes, like BPEL’s metadata and instance data. This exists in x_SOAINFRA schema created by running RCU.

This is separate and independent from any database objects used by your BPEL processes for storing application or business data. For performance reasons, the BPEL schema does not utilize foreign keys and thus master-detail relationships are not obviously inferred from looking at the schema definition.These dependency relationships are maintained by the BPEL engine.

Oracle BPEL Process Manager uses the dehydration store database to maintain long-running asynchronous processes and their current state information in a database while they wait for asynchronous callbacks. Storing the process in a database preserves the process and prevents any loss of state or reliability if a system shuts down or a network problem occurs.

The database schema ddl can be found at: \Oracle_SOA1\rcu\integration\soainfra\sql\bpel. With proper knowledge of this schema, administrators can bypass the BPEL Console and write SQL queries against the store directly OR use BPEL Process Manager API.

Oracle BPEL Process Manager Console provides a user-friendly, Web-based interface for management, administration, and debugging of processes deployed to the BPEL server. BPEL Process Manager API provides an exhaustive set of classes to find, archive, delete instances in various states, delete callback/invoke messages across different domains, or query on the status of specific domain, process, or instance. In production environments, administrators need strong control over management tasks. Via a PL/SQL query or BPEL API against the BPEL Dehydration Store database, it is possible to automate most of these administrative tasks.


Key classes for performing administrative tasks are:

Class/Interface Methods
Class WhereConditionHelper Provides methods such as whereInstancesClosed(), whereInstancesStale(), and whereInstancesOpen(), which construct a where clause that search for respective instances.
Interface IBPELDomainHandle Allows the developer to perform operations on a running BPEL process domain. Provides methods such as archiveAllInstances(), deleteAllInstances(), d eleteInstancesByProcessId(), deployProcess(), and undeployPorcess(), deleteAllHandledCallback(), and deleteAllHandledInvoke().
Interface IinstanceHandle Allows the user to perform operations on an active instance. Provides methods such as isStale() , getState() , getModifyDate() , and delete() .
Class Locator Allows the user to search for processes, instances, and activities that have been deployed and instantiated within an Orabpel process domain. Provides methods such as listInstances() and listActivities() and can take where clauses as parameters.
Tables and their relationships are:

TASK table stores tasks created for an instance. The TaskManager process keeps its current state in this table. Upon calling invoking the TaskManager process, a task object is created, with a title, assignee, status, expiration date, etc. When updates are made to the TaskManager instance via the console the underlying task object in the db is changed.
Table nameDescription
CUBE_INSTANCEContains one entry for each BPEL instance created. It stores instance meta data information like creation date,last modified date, current state, process id etc.
An important column is cikey. Each BPEL instance is assigned a unique ID -  is the instance ID that you see in your BPEL console.Gets incremented in a sequence with creation of BPEL instances. This key cuts across a lot of tables in the dehydration tables.
Following are processes state codes and their meaning
StateCode
Closed and Aborted8
Closed and Cancelled7
Closed and Completed 5
Closed and Faulted 6
Closed and (Pending or Cancel)4
Closed and Stale9
Initiated 0
Open and Running1
Open and Suspended2
Open and Faulted
                     3
CUBE_SCOPEStores the scope data for an instance. It stores BPEL scope variable values & some internal objects to help route logic throughout the flow.
INVOKE_MESSAGEStores incoming (invocation) messages (messages that result in the creation of an instance). This table only stores the meta data for a message (for example, current state, process identifier, and receive date). Following are message states and their meanings
StateDescriptionCode
CANCELLEDMessage Processing Cancelled3
HANDLEDMessage is processed2
RESOLVEDMessage is given to BPEL PM but not yet processed1
UNRESOLVEDMessage is not yet given to BPEL PM0
DLV_MESSAGECall back messages are stored here. All non-invocation messages are saved here upon receipt. The delivery layer will then attempt to correlate the message with the receiving instance. This table only stores the metadata for a message. (eg. current state, process identifier, receive date).
WORK_ITEMStores activities created by an instance. All activities in a BPEL flow have a work_item table. This table includes the meta data for the activity (current state, label, and expiration date (used by wait activities)). When the engine needs to be restarted and instances recovered, pending flows are resumed by inspecting their unfinished work items.
SCOPE_ACTIVATIONScopes that need to be routed/closed/compensated are inserted into this table. In case of system failure, we can pick up and re-perform any scopes that should have been done before the failure
DLV_SUBSCRIPTIONStores delivery subscriptions for an instance. Whenever an instance expects a message from a partner (for example, the receive or onMessage activity) a subscription is written out for that specific receive activity. Once a delivery message is received the delivery layer attempts to correlate the message with the intended subscription
AUDIT_TRAILStores record of actions taken on an instance. As an instance is processed, each activity writes events to the audit trail as XML. As the instance is worked on, each activity writes out events to the audit trail as XML which is compress ed and stored in a raw column.
AUDIT_DETAILSStores details for audit trail events that are large in size. Audit details are separated from the audit_trail table due to their large size. The auditDetailThreshold property in Oracle BPEL Control under Manage BPEL Domain > Configuration is used by this table. If the size of a detail is larger than the value specified for this property, it is placed in this table. Otherwise, it is placed in the audit_trail table
XML_DOCUMENTStores process input and output xml documents. Separating the document storage from the meta data enables the meta data to change frequently without being impacted by the size of the documents
WI_EXCEPTIONStores exception messages generated by failed attempts to perform, manage or complete a work item. Each failed attempt is logged as an exception message
PROCESS_DESCRIPTORStores BPEL processes deployment descriptor(bpel.xml)
Record of events (informational, debug, error) encountered while interacting with a process.
INVOKE_MESSAGE_BINStores invoke payload of a process. This table has foreign key relationship with INVOKE_MESSAGE table
DLV_MESSAGE_BINStores received payload of a call-back process. The metadata of a callback message is kept in the dlv_message table, this table only stores the payload as a blob. This separation allows the metadata to change frequently without being impacted by the size of the payload (which is stored here and never modified).
This table has foreign key relationship with DLV_MESSAGE
WFTASKStores human workflow tasks run time meta data like taskid,title,state,user or group assigned, created and updated dates.
WFTASKMETADATAStores task meta data. Content in this table comes from '.task' file of BPEL project
WFASSIGNEEStores task assignee information
WFMESSAGEATTRIBUTEStores task input payload parameters
WFATTACHMENTStores task attachments
WFCOMMENTSStores task comments

In a production environment, it will be necessary to archive the information before you delete the information—and to do so for hundreds of instances. Fortunately, you can achieve this goal using PL/SQL or EJB.

Datastore for Dehydration Store:
Oracle BPEL Server obtains database connections using an application server JTA data source. Oracle BPEL Server by default is configured to use the Oracle Database Lite dehydration store. For stress testing and production, Oracle recommends that you use Oracle Database 10g/11g. The same recommended when BPEL involves large attachments.

Domain and Process Configuration Property Settings

Two types of processes in Ora BPM. These processes impact the dehydration store database in different ways:
  • Transient processes: does not incur any intermediate dehydration points during process execution. If there are unhandled faults or there is system downtime during process execution, the instances of a transient process do not leave a trace in the system. Instances of transient processes cannot be saved in-flight (whether they complete normally or abnormally). Transient processes are typically short-lived, request-response style processes. Eg: synchronous process.
  • Durable processes: incurs one or more dehydration points in the database during execution because of the following activities:
    • Receive activity
    • OnMessage branch in a pick activity
    • OnAlarm branch in a pick activity
    • Wait activity
    Instances of durable processes can be saved in-flight (whether they complete normally or abnormally). These processes are typically long-living and initiated through a one-way invocation. Because of out-of-memory and system downtime issues, durable processes cannot be memory-optimized. The asynchronous process you design in Oracle JDeveloper is an example of both transient and durable processes.
Idempotent BPEL Property
A BPEL invoke activity is by default an idempotent activity, meaning that the BPEL process does not dehydrate instances immediately after invoke activities.  
  • false: activity is dehydrated immediately after execution and recorded in the dehydration store. provides better failover protection, but at the cost of some performance, since the BPEL process accesses the dehydration store much more frequently
  • true (default): If Oracle BPEL Server fails, it performs the activity again after restarting. This is because the server does not dehydrate immediately after the invoke and no record exists that the activity executed.
    This setting can be configured for each partner link in the bpel.xml file.

Refer:
BPEL Process Manager API
Managing a BPEL Production Environment 
Purging strategies for dehydration store
jaisy-OrabpelInterface - JMX monitoring for Oracle Bpel Process Manager
Ora BPEL PM Performance Tuning
Ora BPEL Webinar
SOA Best Practices: The BPEL Cookbook
Pattern-based Evaluation of Oracle-BPEL - also good to understand xml block to each bpel component
Migrating dehydration for oc4j server in Ora BPM
Oracle BPEL PM - Components
Ora BPEL thru OSB
Exposing Ora BPEL processes as Web services in OSB layer
When to use OSB & BPEL?
BPEL 10g Purging Strategy
BPEL 10g Partitioning

Oracle BPEL PM - Components

  • BPEL Designer—a graphical and user-friendly way to model, edit, design, and deploy BPEL processes. BPEL Designer also enables you to view and modify the BPEL source code. This is SOA Composite Editor in Oracle JDeveloper.
  • Oracle BPEL Server—the server to which you deploy the BPEL process that you design and that contains human workflow, technology adapters, and notification services components. Default=Weblogic AS. Websphere can also be configured
  • Oracle BPEL Console—the console from which you run, manage, and test your deployed BPEL process. Oracle BPEL Console provides a Web-based interface for management, administration, and debugging of processes deployed to Oracle BPEL Server.
  • Dehydration store - by default Oracle Database Lite; other enterprise db like Ora10g/11g & SqlServer can also be configured for this using JTA datasource.
Also, read related topic:

Saturday, November 20, 2010

Compensational Transaction - maintaining Integrity in SOA

Transaction processing techniques play a major role in preserving data consistency in critical areas of computing. The reliability provided through transactional guarantees are required in many types of applications, found in for instance workflow systems, mobile systems, and lately also in SOA like web services based systems.

Web services provide interoperable application-to-application communication, allowing new applications to leverage existing software functions in a platform independent fashion. The transactional behaviour of a function accessed through a web service depends on the underlying implementation of the web service. Often a database system will provide the required local transactional behaviour. However, when an application combines multiple web services in order to complete a given task, coordination of the participating web services is required in order to preserve data consistency.
Traditionally two phased commit (2PC) based protocols have been used to achieve such coordination (e.g. X/Open DTP, CORBA OTS). Because of the loosely-coupled nature and autonomy requirements of web services, 2PC-based protocols may however not be appropriate in this environment. This could be because of the following reasons:
  • The application uses multiple non-extended-architecture (XA) resources.
  • The application uses more than one atomic transaction, for example, enterprise beans that have Requires new as the setting for the Transaction field in the container transaction deployment descriptor.
  • The application does not run under a global transaction.
A web service is either a stand-alone service or a composite service relying on other web services to perform its task. Individual web service invocations may commit early without further coordination, provided that the effect of the invocation can be semantically reversed at some later point by executing a compensating transaction. Typically, compensating transactions are not focused in the design of web service transaction models, and implementation of this functionality is left to the application developer, here web service developer.

This is especially relevent in case of long-running transactions that avoid locks on non-local resources, use compensation to handle failures, potentially aggregate smaller atomic transactions. In contrast to rollback in ACID transactions, compensation restores the original state, or an equivalent, and is business-specific. The compensating action for making a hotel reservation is canceling that reservation, possibly with a penalty.

Interaction between web services, are typically handled through conversational transactions, that involve participation from several web services. The unit of business at each web service represents a subtransaction, also called component transaction.
The transactional behaviour of a single subtransaction is typically provided locally by an underlying database system. Additionally, transactional behaviour of the conversational transaction must be guaranteed through coordination and management of the set of subtransactions. If one or more subtransactions abort, the conversational transaction may or may not need to be cancelled depending on the business logic of the service. It is totally up to the web service starting the conversation to decide if all-or-nothing semantics should be enforced.
Within classical transaction processing, dependent transactions would have to be aborted if the dependent-upon transaction aborted. Resorting to cascading rollback of dependent transactions is however not acceptable in web services, both since dependent transactions may themselves be committed, and also since rollback may be disallowed by autonomous web services. Autonomous web services typically consider the results of a committed subtransaction as final and durable.

Here, the Compensating Transaction enters the stage - to semantically undo the results of the early committed subtransactions. A compensating transaction preserves database integrity without aborting other transactions.

Compensation Transaction -> semantically undoes the partial effects of a transaction T without performing cascading abort of dependent transactions, restoring the system to a consistent state.
The web services designer is responsible for determining the compensation rules, which are used to dynamically generate compensating transactions during runtime.

This can be automated by:
  • In BPEL, using invocable Compensating Transaction
  
  •  Coordinator protocols like OASIS Business Transaction Processing, and WS-CAF - mediate the successful completion or use of compensation in a long-running transaction.
  • Including a Rules Engine (which does on an Event if a Condition satisfied does an Action)
  • Custom solution using database as a rules repo(using triggers for events)

Also, read related blogs:

Sunday, November 7, 2010

SOA Composite Editor for JDeveloper - installation

Oracle SOA Composite Editor - JDeveloper extension for SOA technologies: SOA Composite Assembly, BPEL PM, Mediator, Human Task, Business Rules, Adapters.


    1. Help->Check for updates
       In the Update Wizard, select Search Update Centersand ensure Oracle Fusion Middleware Products is checked. Select Oracle SOA Composite Editor and click on Next to begin downloading.
        If this doesn't work add a new update site with link: 
http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/156082.xml
       and it'll show the editor for updating JDev


    2. From file - Direct download file at
 In the Update Wizardhttp://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/156082.xml
        and choose install from file radio option. This file is about 230MB.


References
Installing JDev for BPM

BPELscript - javascript-like language for BPEL

BPELscript is a language to specify BPEL processes. It provides a compact syntax inspired by scripting languages such as JavaScript and Ruby and a full coverage of all features provided by BPEL. A programming language which omits the XML-overhead of BPEL but offers the same features as BPEL.
BPELscript provides:
  1. a compact syntax inspired by scripting languages such as JavaScript and Ruby
  2. the full coverage of all features provided by BPEL
  3. a translation from & to WS-BPEL 2.0
  4. The translation to WS-BPEL 2.0 ensures that BPELscript can be executed on all workflow engines supporting WS-BPEL 2.0.
Eg:

namespace pns = "http://example.com/loan-approval/";  
namespace lns = "http://example.com/loan-approval/wsdl/"; 
@type "http://schemas.xmlsoap.org/wsdl/"  
import lServicePT = lns::"loanServicePT.wsdl"; 
@suppressJoinFailure  
process pns::loanApprovalProcess {  
    partnerLink customer = (lns::loanPartnerLT, loanService, null),  
    approver = (lns::loanApprovalLT, null, approver),  
    assessor = (lns::riskAssessmentLT, null, assessor);  
    try {  
        parallel { 
            @portType "lns::loanServicePT" @createInstance  
            request = receive(customer, request);  
            signal(receive-to-assess, [$request.amount < 10000]);  
            signal(receive-to-approval, [$request.amount >= 10000]);  
        } and {  
            join(receive-to-assess); 
            @portType "lns::riskAssessmentPT"  
            risk = invoke(assessor, check, request);  
            signal(assess-to-setMessage, [$risk.level = 'low']);  
            signal(assess-to-approval, [$risk.level != 'low']);  
        } and {  
            join(assess-to-setMessage);  
            approval.accept = "yes";  
            signal(setMessage-to-reply);  
        } and {  
            join(receive-to-approval, assess-to-approval); 
            @portType "lns::loanApprovalPT"  
            approval = invoke(approver, approve, request);  
            signal(approval-to-reply);  
        } and {  
            join(approval-to-reply, setMessage-to-reply); 
            @portType "lns::loanServicePT"  
            reply(customer, request, approval);  
        }
    }  
    @faultMessageType "lns::errorMessage"  
    catch(lns::loanProcessFault) { |error| 
        @portType "lns::loanServicePT" @fault "unableToHandleRequest"  
        reply(customer, request, error);  
    }  
}

how it works:
It uses a translator based on the ANTLR v3 (ANother Tool for Language Recognition) parser generator which is based on a predicated-LL(*) parsing strategy. This solution uses the implicit tree structure behind the input sentences to construct an abstract syntax tree (AST) which is a highly processed and condensed version of the input. The translator maps each input sentence of the source language to an output sentence by embedding actions (e.g. code) within the grammar or tree. This actions will be executed according to its position within the grammar or tree. To support an easy handling of implicit declarations the translation is broken down into multiple passes.

References: