Level: Intermediate Sunita Chacko (schacko@ca.ibm.com), Managing Consultant, IBM Toronto Jeff Brent (jeffb@us.ibm.com), Senior Software Engineer, IBM
29 Oct 2008 As you author applications in WebSphere Integration Developer, you may find it necessary to set or verify the invocation style that one component will use to call another. Users are often surprised to find that this is not as easy a task as it may seem. This article explains how to determine which invocation style will be used at runtime, based on characteristics of your application.
Introduction
When authoring applications in IBM® WebSphere® Integration Developer, it is a best practice to explicitly set the invocation style that each of your components use to call each other.
At a minimum, you will want to know what invocation styles are used throughout your application while you do performance analysis or develop your error handling strategy. You will certainly need
to understand the interactions in your application when you consider/set your transaction boundaries. Users are often surprised to find that setting or determining invocation styles between components
is not as easy a task as it may seem. This article explains how to set or determine which invocation style will be used at runtime, based on specific characteristics of your application.
The invocation styles that SCA provides are:
- Synchronous
- Asynchronous with callback
- Asynchronous with deferred response
In general, when considering an interaction from one component (source or client) to
another (target), the service client determines what type of invocation will be used.
For example, if your source component is a Java™ component, the invocation style from source to target is determined by the particular SCA invocation API you use in the implementation (invoke(), invokeAsync(), or invokeAsyncWithCallback()). Each of the other components provided in WebSphere Process Server has a set of rules that it uses to determine whether an invocation should be synchronous or asynchronous.
Some components/imports are considered "asynchronous":
- Long running BPEL
- Human tasks
- MQ/MQ JMS/Generic JMS/JMS imports
All invocations to components/imports of these types must be asynchronous invocations. If the calling component (or source) initiates the interaction synchronously, SCA will switch the interaction to be asynchronous.
Invocation style depends on
the source component
As mentioned, the source component determines what type of invocation will be used. For each component type, there may be multiple properties that you need to set; for example, the Preferred Interaction Style on the target component interface is one of these properties. In the next several sections, you will find details on how to set these property values in WebSphere Integration Developer. Following that, we present the factors that determine interaction style based on component type. If you are familiar with Preferred Interaction Style, the Force Sync attribute, or the Interaction Style performance attribute, you may skip these sections. If you are developing or reviewing an application, you may find it useful to jump to the corresponding component type that represents your client component.
All information in this article pertains to WebSphere Integration Developer V6.1.2 except where explicitly mentioned. Earlier versions of the product have different defaults and characteristics in some cases.
Setting the Preferred interaction style
In most cases, the Preferred interaction style can be set to the desired value. The options available are:
- Synchronous (default)
- Asynchronous
- Any
This is an attribute that can be set on the interface of a component/import/export in the assembly diagram. To locate it, select the component in the assembly editor. Look at the Properties view and select the Details tab. Select an interface. The Preferred interaction style field on the details tab will be displayed:
Figure 1. Setting the Preferred interaction style
Note that prior to V6.1.2, the default value for Preferred interaction style was "Any".
This property is documented in the WebSphere Integration Developer Information
Center, on the following page, under Preferred
interaction style.
Setting
the 'Force Sync' attribute
For Service Invoke nodes within WebSphere Enterprise Service Bus, you will
additionally need to set/check the properties of the node itself. To locate the
relevant property (called Force Sync in the table below and in the Information
Center), select the node in your mediation flow. Look at the Properties view and select the Details tab. You will see two checkboxes on this page. It is the second one that is relevant here:
Figure 2. Setting the Force Sync attribute on Service Invoke nodes
This property is documented in the WebSphere Integration Developer Information Center
Setting the 'Interaction style' performance attribute
For inbound EIS calls (that is, inbound adapter calls), you will need to set/check a different interaction style attribute. It is on the Binding tab of the Export properties page in the assembly diagram. Select the Export, look at the Properties view and select the Binding > Performance attributes tab. You will see the Interaction style field:
Figure 3. Setting the Interaction style performance attribute
Java components
The SCA API that is used in the Java implementation to make the invocation determines what the invocation style will be at runtime:
invoke(): Synchronous
invokeAsync(): Asynchronous
invokeAsyncWithCallback(): Asynchronous
This is explained in more detail in the following article, Exception handling in
WebSphere Process Server and WebSphere Enterprise Service Bus, under the section Advanced
invocation style determination.
BPEL
Table 1. Invocation styles used by short running processes
When the calling component is a short running process, the preferred interaction style is honored for one-way target operations. However, invocations to request-response operations from a short running process will always be synchronous. All asynchronous invocations are made using the invokeAsyncWithCallback invocation style, never asynchronous deferred response.
| Preferred interaction style of target component or import | One-way Operation | Request-response Operation |
|---|
| Synchronous | Synchronous invocation | Synchronous invocation |
|---|
| Asynchronous | Asynchronous invocation | Synchronous invocation |
|---|
| Any | Asynchronous invocation | Synchronous invocation |
|---|
This information is documented here in the WebSphere Integration Developer
Information Center (see Table 1):
Table 2. Invocation styles used by long running processes
When the calling component is a long running process, the preferred interaction style is always honored. As above, all asynchronous invocations are made using the async with callback invocation style, never asynchronous deferred response.
| Preferred interaction style of target component or import | Operation Type | Invocation style |
|---|
| Synchronous | Any | Synchronous |
|---|
| Asynchronous | Any | Asynchronous (with callback) |
|---|
| Any | Any | Asynchronous (with callback) |
|---|
This information is documented here in the WebSphere Integration Developer
Information Center (see Table 1):
Human tasks
Table 3. Invocation styles used by invocation tasks
| Incoming invocation style | Target component type | Invocation style used |
|---|
Synchronous (using the callTask API) | To-do task | Asynchronous |
|---|
| | any other component | Synchronous (watch out for an async switch in this scenario) |
|---|
Asynchronous (using the startTask API) | any | Asynchronous |
|---|
The BPC Explorer uses an asynchronous invocation style (via the HTM API). The Preferred interaction style on the target component is always ignored.
This information is documented in the WebSphere Integration Developer Information Center:
Interface maps
Table 4. Invocation styles used by interface maps
| Incoming invocation style | Source operation type | Target operation type | Preferred interaction style of target component or import | Invocation style used |
|---|
| Synchronous | any | any | Synchronous | Synchronous | | one-way | request-response | Asynchronous | Asynchronous (with callback) | | request-response | any | Asynchronous | Synchronous | | any | any | Any | Synchronous | | Asynchronous | any | any | Synchronous | Synchronous | | any | one-way | Asynchronous | Asynchronous | | any | request-response | Asynchronous | Asynchronous (with callback) | | any | one-way | Any | Asynchronous | | any | request-response | Any | Asynchronous (with callback) |
If the interface map was called asynchronously, the preferred interaction style is honored. If the map was called synchronously the preferred interaction style is ignored, except when the source operation is a one-way operation. Like BPEL, interface maps always use the invokeAsyncWithCallback invocation style for asynchronous request-response invocations.
The invocation behavior of interface maps has changed from version to version. The information above applies to V6.1.x.
Callout nodes and service
invoke nodes
The invocation styles used by callout nodes and service invoke nodes are documented
at the following two links in the WebSphere Integration Developer Information Center:
The term Force Sync in the Service Invoke Table refers to a setting on the service invoke properties page. This property is described in the Setting the 'Force Sync' Attribute section.
In earlier releases (V6.0.2), the Preferred interaction style is ignored for all callout node invocations. All one-way operations are invoked asynchronously, and all request-response operations are invoked synchronously. The only exception to this rule is when a mediation flow component is called using the invokeAsyncWithCallback invocation style. In this case, the callout node invocation will also be made using invokeAsyncWithCallback invocation style.
Service invoke nodes were introduced in V6.1
Business rules and selectors
Both Business Rules and Selectors always use synchronous invocations. You should be wary of using these in combination with components that must be invoked asynchronously (for example, long running processes and human tasks), as this will lead to an async switch between the Business Rule or Selector and the asynchronous target.
Business state machines
Table 5. Invocation styles used by business state machines
The runtime artifacts for business state machines are long running processes, so the invocation behavior is the same for both.
| Preferred interaction style of target component or import | Operation Type | Invocation style |
|---|
| Synchronous | Any | Synchronous |
|---|
| Asynchronous | Any | Asynchronous (with callback) |
|---|
| Any | Any | Asynchronous (with callback) |
|---|
Export bindings
Table 6. Invocation styles used by export bindings
The invocation style used by SCA exports and Standalone References depends on the style used by the invoker.
| Export binding type | Operation Type | Performance attributes > Interaction Style | Invocation style |
|---|
| EIS | one-way | Asynchronous | Asynchronous (default) | | one-way | Synchronous | Synchronous | | request-response | any | Synchronous | | HTTP | any | n/a | Synchronous | MQ MQ JMS JMS | one-way | n/a | Asynchronous | | request-response | n/a | Asynchronous (with callback) | | Web services (soap/http or soap/jms) | any | n/a | Synchronous |
Conclusion
In this article, we have provided a single point of reference for each the different
interaction styles used by WebSphere Process Server and WebSphere ESB components. Use
the information here to ensure that your application uses the appropriate invocation
style based on your service endpoints, performance requirements, and so forth.
Resources
About the authors  | |  | Sunita Chacko is a Managing Consultant with Software Services for WebSphere at the IBM Toronto Lab. Sunita divides her time between providing technical expertise to WebSphere Process Server customers and field expertise to the WebSphere development teams. You can reach Sunita at: mailto:schacko@ca.ibm.com. |
 | |  | Jeff Brent is a Senior Software Engineer for WebSphere Process Server development in West Palm Beach Florida. Jeff is the lead for the WebSphere Process Server SWAT team and spends much if his time working with customers resolving deep technical issues. In his free time, he enjoys spending time with his family at the beach and playing basketball. You can reach Jeff at: jeffb@us.ibm.com. |
Rate this page
|