This scenario discusses different ways to access services that are external to the application, and provides high level tasks for accessing these external services.
In an integrated business application, business services interact with each other to provide a required function. A business service performs a repeatable function or task that contributes towards achieving a business goal. But the work of locating a service and connecting to it is not related to the business function. Separating the business function from the task of managing service connections provides flexibility to a solution.
Service interaction begins when a service requester sends a request to a service provider to perform a business function. This request is sent in the form of a message, which defines the function to be performed. The service provider performs the requested function and sends the result in a message to the service requester. Typically, messages need to be processed in order to allow the services to exchange data, and to implement other low level IT functions that are independent of the business functions and data. For example, routing, protocol conversion, transformation, retry of a failed invocation, and dynamic service invocation. This processing is known as mediation.
There are two types of modules in IBM Integration Designer; modules (or business integration modules), which are primarily designed to contain business logic (such as business processes, business rules and business state machines), and mediation modules, which implement mediation flows. Although there is some overlap of function between the two types of modules, in general, we recommend that business logic be isolated in business modules and mediation logic be performed by mediation modules.
But there is not always a clear separation between business and mediation logic. In these cases, consider the amount of state, or data in variables that will need to be processed between service invocations. In general, if there is little or no state processing required, consider using a mediation flow component. If you need to store state between service invocations, or if you have data that will need to be stored in variables and processed, consider using a business process component. For example, if you are calling multiple services and recording the information that is returned from each, so that after invoking all the services, you want to do some further processing with the returned data, use a business process where you can easily assign the returned information to variables. In other words, when you have too much state you have crossed the line into business logic. The following sections help clarify this guidance.
There is no one integration scenario, and there is no technically wrong answer. The guidelines that we discuss here are good practice to enable flexibility and reuse, and are presented for your consideration. As usual, you should carefully consider the benefits and drawbacks of implementing these patterns for your business integration application. Let's consider some situations.
A basic example of accessing a service is when an import calls another SCA component, without requiring any data transformation. Even in this situation, you could access the external service from a mediation module, rather than accessing it directly from a business module. This would allow flexibility in the future, for changing the service endpoint or qualities of service or governance (for example, adding logging) without impacting the business components that consume the service. This architectural pattern is known as "separation of concerns".
Before you decide to implement this pattern, weigh the benefits of the pattern against the potential effects of overhead introduced by another module. If your main requirement is flexibility, and you are going to make frequent changes to the services accessed, consider using a separate module as shown here. If performance is most important, and you are willing to update and redeploy the business logic, consider using a single module.
Later, you can add mediation logic such as logging or routing to the mediation module without affecting the business module.
Sometimes it is not sufficient to simply invoke an external service. Sometimes you need to do processing first, by adding a mediation module as an intermediary between the service requester and provider.
Services and artifacts on external systems can be imported into Integration Designer. A wizard discovers applications and data on an Enterprise Information System (EIS) and lets you generate services from the discovered applications and data. The generated artifacts are interfaces and business objects, which can be used by components in a module.
Using an intermediary mediation module between a module and a host system makes it more reusable. In the example below, a mediation flow is used to route to the correct host system, and to transform the data to the format required by the host system.
In order for your service component architecture (SCA) module to communicate to an existing JMS, MQ or MQ JMS messaging client, you need to create interfaces, business objects and bindings for imports and exports. See Mapping a message to an SCA interface.
Mediation flows use messages, which provide access to context and header information in addition to business objects. If you want access to JMS header information or a custom JMS property, use a mediation flow. If you are integrating with an MQ system, and you want to access MQ header information, use a mediation flow.