Part 1 : Introduction
Let’s take a look at a common Enterprise Service Bus (ESB)-based integration pattern; Figure 1 shows this:
Figure 1. ESB-based integration pattern
The service consumer systems interact with the service provider system,
through the ESB. This can be through a synchronous or an asynchronous request
to the service provider. The ESB performs the data transformations and the routing aspects of the requests.
It usually happens that the service provider systems need to notify the service consumer
systems of the updates happening within them, but are not capable to do so. In such situations, the corresponding ESB mediation module needs to be proactive
enough to keep polling the service provider system from time to time, synchronously while looking for updates.
Whenever the updates are found and returned, the mediation module would transform them and post them to the service consumer
systems (or mediation modules corresponding to the service consumer systems). Figure 2 illustrates this.
Figure 2. Proactive polling by the mediation module
Tutorial Scenario
In this tutorial, we will see how to develop a mediation module poll to a system
periodically. This is achieved by using a combination of Startup bean, scheduler
and messaging tasks provided by WebSphere Application Server and WebSphere
Enterprise Service Bus to time the mediation module.
We will implement the following scenario, illustrated in Figure 3:
Figure 3. Tutorial Scenario
Startup beans enable Java 2 Platform Enterprise Edition (J2EE) applications to run
business logic automatically, whenever an EJB module starts or stops normally. This
service needs to be enabled through the admin console of WebSphere Process Server or
WebSphere Enterprise Service Bus instance. For more information about startup beans,
please refer to the resources at the end of this tutorial.
SampleStartupBeanEJB host the startup bean which spawn a task and register it
with a sample scheduler. The scheduler will periodically run the task, which post
a trigger message onto a queue on System Integration Bus (SI Bus). The Timer Mediation Module would look for these trigger messages. Once a trigger message arrives, the mediation picks it up and calls a Web service exposed by the Sample Web service (service provider).
In an ideal situation, the Web service would return with updates occurring within
the system hosting it. These updates are then posted by the mediation to the
subscribers, through a publish-subscribe mechanism, which we will not delve into, as it’s out of the scope of this tutorial.
Scenario Implementation
The implementation of this scenario will involve the following steps and will be demonstrated in their respective sections:
- Creating and connecting the "TimerMediationModule" and the "SampleWeb Servicemodule" (Service Provider)
- Creating the SampleStartupBeanEJB module
- Creating and configuring the necessary resources on WESB
- Implementing the SampleStartupBean
- Configuring the JMS Export for the "Timer Mediation Module"
- Testing the scenario end-to-end
In the next section, we will create and implement the "TimerMediationModule" and the "SampleWebServiceModule" modules.
|