Contents


Implement the facade pattern using IBM Business Process Manager Advanced V8.5.5 and earlier

Maximize efficiency and reuse

Comments

If you are implementing Advanced Integration services in IBM Business Process Manager (BPM) Advanced V8.5.5 and earlier versions, follow the steps in this tutorial. To work with Advanced Integration services in IBM BPM V8.5.6 and later versions, see Develop Advanced Integration services for IBM Business Process Manager V8.5.6.

In Best practices when using IBM Integration Designer and IBM Process Designer together, the authors recommend the facade pattern: "A good pattern to avoid excessive or accidental breakages is to 'facade' the data types and the interfaces, isolating the models from changes introduced through the other tool." This article explores the facade pattern in more detail. Learn how to use IBM BPM to implement the facade pattern efficiently and maximize service reuse.

In the programming model for IBM BPM Advanced, Advanced Integration services are used to implement complex integration logic that can be reused in building IBM BPM human-centric processes. Reuse of Advanced Integration services in IBM BPM applications (process apps) is a desirable goal to pursue when designing and packaging Advanced Integration services. As shown in the following screen capture, the Claims Processing BPD reuses the Automated Claim Processing Advanced Integration service that is defined in the Services Facade TK Toolkit.

process app reusing AIS implemented in a toolkit
process app reusing AIS implemented in a toolkit

When a process app reuses an Advanced Integration service, it must include the toolkit in which the Advanced Integration service is implemented. Since each process app deployed to the server will deploy its own copy of the toolkits it includes, including a large number Advanced Integration service implementations in a toolkit (for reuse) and then reusing the toolkit in multiple Process Apps will result in a large number toolkit copies being deployed to the server. The following screen capture shows that three Process Apps reusing an Advanced Integration service implemented in a toolkit results in three EARs being deployed to the Process Server. A large number of deployed EARs may negatively impact the server performance and make administration tasks more complex.

Each deployed process app instance results in a new Toolkit                     implementation EAR
Each deployed process app instance results in a new Toolkit implementation EAR

This article describes a design pattern for the efficient runtime implementation of reusable Advanced Integration service implementations in IBM BPM V8.5.5 and earlier versions that eliminates the deployment of multiple Advanced Integration service implementations.

Creating a Facade Pattern Cookbook Overview

In this article we'll describe a "meet in the middle" approach, in which the business user defines an Automated Claim Advanced Integration service and the IT developer already has an implementation for the Advanced Integration service defined by the business user.

We'll cover the following major steps, as shown in the following screen capture:

  1. Create a Services Facade TK toolkit – The business user creates a Services Facade TK Toolkit and in it defines the Automated Claim Processing Advanced Integration service. This is the interface that the business user will use to communicate with the service.
  2. Create a Service Facade TK toolkit Advanced Integration service implementation – The IT developer creates a skeletal Advanced Integration service facade implementation. This is a "logic-free" implementation of the service that will simply proxy invocations to the actual service implementation.
  3. Create a Service Implementation PA process app - The IT developer creates a Service Implementation PA process app where the Advanced Integration service implementation logic is defined.
  4. Connect the Advanced Integration service cefinition to the Advanced Integration service implementation – The IT developer connects the implementation in the Service Implementation PA process app to the Advanced Integration service definition in the Services Facade TK toolkit.
  5. Reuse Advanced Integration service – The business user includes the Service Facade TK toolkit in the Service Consumer PA process app and reuses the Advanced Integration service from the toolkit.
Summary of major development steps
Summary of major development steps

Step 1. Create the Services Facade TK toolkit

In this step, the business user creates the facade toolkit and then defines the business objects that will become part of the Advanced Integration service interface. This will be the interface that the Service Implementation PA process app needs to conform to. The toolkit will be shared by the Claims Processing PA process app and the Service Implementation PA process app.

  1. The business user uses Process Designer to create a new toolkit, using a naming convention that reflects the fact that this is a Service Facade toolkit, as shown in the following screen capture. Create the facade toolkit
    Create the facade toolkit
  2. The business user opens the toolkit in Process Designer, as shown in the following screen capture:Create business                     object
    Create business object

    Then the business user creates a business object that will become part of the Advanced Integration service interface, as shown in the following screen capture: Add business object parameters
    Add business object parameters
  3. The business user creates the Advanced Integration service, as shown in the following screen capture. In the sample code, the Advanced Integration service name is AutomatedClaim. Create Advanced Integration service
    Create Advanced Integration service

    The user than adds input and output parameters, as shown in the following screen capture. Add parameters
    Add parameters
  4. The business user then creates a snapshot, which is required in order to be able to reuse the facade toolkit.

Step 2. Create the service façade toolkit Advanced Integration service implementation

In this step, the IT developer creates the skeleton for the façade Advanced Integration service implementation. This implementation will eventually invoke the actual Advanced Integration service implementation.

  1. The developer opens the facade toolkit in Integration Designer, as shown in the following screen capture. Open the facade                     toolkit in Integration Designer
    Open the facade toolkit in Integration Designer
  2. The developer then implements the facade Advanced Integration service, as shown in the following screen capture, and selects an empty implementation. Implement facade Advanced Integration service as an empty implementation
    Implement facade Advanced Integration service as an empty implementation

    The assembly diagram now shows a Sservice Component Architecture (SCA) Advanced Integration service export, as shown in the following screen capture.

    SCA Advanced Integration service export in                     assembly diagram
    SCA Advanced Integration service export in assembly diagram

Later on we'll connect the SCA Advanced Integration service export to the actual implementation. Remember that the key point of the facade pattern is not to have any implementation logic in the toolkit!

Step 3. Create the Service Implementation PA process app

In this step the IT developer creates a process app that implements the service defined in the facade toolkit.

  1. The IT developer uses Integration Designer to create the process app for the facade implementation, as shown in the following screen capture. Create implementation process app
    Create implementation process app
  2. The developer opens the process app in the workspace and then selects Change Toolkit Dependencies, as shown in the following screen capture, to make the process app dependent on the service facade toolkit. The reason for creating this toolkit dependency is to expose the Advanced Integration service interface to the implementation logic. Create dependency on service implementation toolkit
    Create dependency on service implementation toolkit
  3. The developer then selects Open Snapshot in Workspace, as shown in the following screen capture, to bring the read-only (unavailable, as shown in the next screen capture) content of the toolkit into the workspace. Bring the facade toolkit into the workspace
    Bring the facade toolkit into the workspace

    Note that this also brings in the Advanced Integration service interface, as you can see in the following screen capture.

    Advanced Integration service business object and interface                     in workspace
  4. The developer adds the ServicesFacade Library to the Dependencies of the service implementation module, as shown in the following screen capture. This is needed to make the Advanced Integration service interface accessible to the module. Make ServicesFacade Library accessible to implementation module
    Make ServicesFacade Library accessible to implementation module
  5. The IT developer then creates an SCA export for the service facade implementation using the Advanced Integration service interface from the service facade, as shown in the following screen capture. SCA export of the implementation
    SCA export of the implementation
  6. The developer provides the service facade implementation logic, as shown in the following screen capture. In this example, the implementation already exists but has a different interface, which is typical. The developer provides mediation logic, which could be a BPEL microflow, a WebSphere™ ESB mediation or even, in the simplest cases, an interface mediation component. Service facade implementation with a mediation
    Service facade implementation with a mediation

Step 4. Connect the Advanced Integration service to the implementation

The next step is to revisit the service facade toolkit and connect the Advanced Integration service SCA export to the Advanced Integration service implementation export defined in the Service Facade Implementation process app, as shown in the following screen capture.

Connect the Advanced Integration service to the implementation via SCA export
Connect the Advanced Integration service to the implementation via SCA export
  1. The IT developer opens the service facade toolkit in Integration Designer.
  2. In the assembly diagram, the developer creates an SCA import with the same interface as the SCA Advanced Integration service export and connects the Advanced Integration service export to the SCA import, as shown in the following screen capture. Advanced Integration service export connected to SCA import of the implementation
    Advanced Integration service export connected to SCA import of the implementation
  3. The developer then configures the ServiceImplementation SCA import binding to invoke the SCA export of the service implementation, as shown in the following screen capture. Provide SCA binding information
    Provide SCA binding information

    The Module name is the mangled name of the Advanced Integration service implementation module. In our case, this is Service_Implementation_PA_Implementation prefixed with the acronym and version of the currently deployed Process App, PJP3. Since we have no snapshot of the implementation process app yet, the version is Tip. Tip is used when first testing the service in the Process Center. When promoting the code to a Process Server, the prefix needs to be changed. For example, if the snapshot name is V1.0.0, then the module name would be PJP3-V1.0.0-Service_Implementation_PA_Implementation. Accomplishing this can be a bit tricky. First, decide what the process app snapshot name will be and then change the Module name to include that name, such as PJP3-V1.0.0-Service_Implementation_PA_Implementation. Next, take a snapshot of the façade toolkit. Then update the toolkit dependency in the implementation process app to point to the just created façade toolkit snapshot. Finally, take a snapshot of the Advanced Integration service implementation process app with the name referenced from the toolkit (V1.0.0.

Step 5. Reuse the Advanced Integration service

Now that the developer has built the facade for the Advanced Integration service and created the implementation, the business user can now reference the service facade toolkit in any process app in which he or she wants to reuse the Advanced Integration service.

  1. The business user creates a process app using Process Designer.
  2. The business user then adds the service facade toolkit and selects the version to include, as shown in the following screen capture. Service facade toolkit is reused in a process app
  3. The Advanced Integration service can now be used from the service facade toolkit, as shown in the following screen capture. Advanced Integration service in service facade toolkit is ready for reuse
    Advanced Integration service in service facade toolkit is ready for reuse
  4. In our example, the AutomatedClaimsProcessing Advanced Integration service is reused in the Automated Claims Processing step in a BPD, sa shown in the following screen capture. Advanced Integration service in service facade toolkit reused in a BPD
    Advanced Integration service in service facade toolkit reused in a BPD

Conclusion

In this article, we described how to implement the service facade pattern. This pattern allows Advanced Integration service implementations to be referenced from many Process Apps or toolkits, while only being deployed once to the server. The following screen capture recaps the facade pattern design.

Service facade                     pattern design summary
Service facade pattern design summary

Downloadable resources


Related topics


Comments

Sign in or register to add and subscribe to comments.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Middleware
ArticleID=779782
ArticleTitle=Implement the facade pattern using IBM Business Process Manager Advanced V8.5.5 and earlier
publish-date=01042017