Introducing Oracle Service Bus (OSB)
In any distributed system, components that run on a distributed platform need to communicate or exchange messages with each other. In SOA based systems, services need to interact or exchange messages with other services also. Oracle Service Bus is a product that provides a platform for interaction and message exchange between services.
Integration of disparate services can be a challenge. There could be a difference in messaging models—some services may support the synchronous model, whereas other services may support the asynchronous model. Some services may support HTTP protocol, whereas other services may support JMS protocol. Oracle Service Bus provides helps in solving many of these challenges by providing the following features:
- Support for different protocols, such as HTTP(s), FTP, JMS, E-mail, Tuxedo, and so on
- Support for different messaging models, such as point-to-point model, publish-subscribe model
- Support for different message formats, such as SOAP, E-mail, JMS, XML, and so on
- Support for different content types such as XML, binary, and so on
- Data transformation using XLST and Xquery—data mapping from one format to another format through declarative constructs
Besides the integration support, OSB provides features that help in managing runtime for the integration of services. Some features are:
- Load balancing: Load balancing is very important when traffic volume between services is very high. Load balancing also helps to achieve high availability.
- Content-based routing: Routing to appropriate service based on content is very valuable in the changing business environment.
OSB provides loosely-coupled bus architecture, where all services and consumers of services can be plugged into, and OSB becomes a central place for defining mediation rules between services and consumers, as shown next:
At implementation level, OSB is a set of J2EE applications that run on top of WebLogic J2EE container. It uses various J2EE constructs like Enterprise Java Bean, data source, connectors, and so on. OSB uses a database for storing the reporting data.
OSB can be deployed in a single server model or clustered server model. Generally, in a production environment a clustered model is used, where multiple WebLogic Servers are used for load balancing and high-availability. In such setups, multiple WebLogic Servers are front-ended by a load balancer. The following figure depicts one such clustered deployment.
There are some constructs specific to OSB—let's learn about those constructs.
OSB provides mediation between consumer and provider services. This mediation is loosely coupled where a consumer service makes a call to intermediate service, and the intermediate service performs some transformation and routes it to producer service. This intermediate service is hosted by OSB and called Proxy service.
Business service is a representation of actual producer service. Business service controls the call to business service, it knows about the business service endpoint. In case of failure in calling producer service, it can retry the operation. In case there are multiple producer services, it knows about the endpoint of each producer service and provides load balancing across those endpoints.
Message flow is a set of steps that are executed by the proxy service before it routes to the business service. It includes steps for data transformation, validation, reporting, and so on.
Enterprise Manager provides OSB management from release 10.2.0.5 onwards. The following is the support matrix for EM against different versions of OSB management:
To manage or monitor OSB from Enterprise Manager 10.2.0.5, some patches are needed on OSB servers. The following table lists the patch number for each supported OSB release:
The SmartUpdate patching tool that comes with WebLogic installation can be used to apply these patches. Before downloading or applying these patches, check Enterprise Manager documentation for any updates on patch Ids.
Discovery of Oracle Service Bus
Oracle Service Bus gets discovered as part of WebLogic domain, managed server discovery.We know how Enterprise Manager Agent discovers WebLogic domain and managed servers. Along with domain, cluster and managed server targets, OSB targets are also created and persisted in the Enterprise Manager repository.
Just like WebLogic domain and server targets, OSB can also be discovered and monitored, either by remote agent or local agent. In case you want to use OSB service's provisioning feature you will need to discover/monitor OSB in the local agent mode. In the local agent mode, the agent is installed where the domain admin server is running. In the remote agent mode, the agent can be on any other host on the same network.
After discovery you will see the Oracle Service Bus target on the Middleware tab of the EM homepage. The following screenshot shows the OSB target on the Middleware tab.
Monitoring OSB and OSB services
Under the BPEL monitoring section, we learnt about the BPEL eco system that included BPEL PM, dehydration store, database listener, host, and so on, and how Enterprise Manager provides support for modeling of BPEL eco system as system. Enterprise Manager provides similar support for managing and monitoring OSB eco system.
For monitoring OSB, you can go to the OSB homepage, where you can see the status and availability of OSB. It shows some other details like the host, name of the WebLogic Server Domain where OSB is installed. It also shows some coarse-grained historical view of traffic metrics—where it shows message/error/security violation rates for all the services.
On the Home page there is an option to create an infrastructure system and service. The steps for creating an infrastructure system service is exactly the same as BPEL, so we will not repeat those steps and will leave it as an exercise. The following screenshot shows one such homepage after the infrastructure system services are created.
OSB uses Java Message Service (JMS) queues for receiving, scheduling, dispatching of messages, it's very important to monitor JMS queues for OSB. From the OSB homepage, click on JMS Performance, and you will see the performance of JMS queues used by OSB. The following screenshot shows one such page. You can see the metrics for message inflow and messages pending.
Monitoring OSB services
OSB service monitoring can be divided into two parts—proxy service that receives the requests and business service that dispatches the requests. Proxy service metrics also include the metrics in message flow, where message flow processes the request.
Monitoring proxy services
Performance of proxy services represents the performance seen by consumers of OSB. Besides that, proxy services are hosted by OSB servers. Enterprise Manager collects some very useful metrics for proxy services. These metrics are:
- Status of proxy service
- Throughput metrics at proxy service and endpoint level
- Performance metrics at proxy service level and endpoint level
- Error metrics at service level and end point level
- Security violation at proxy service level
To monitor the performance of message flow, there are some fine-grained metrics available, these metrics include throughput, error rate, and performance at each step in the message flow.
Let's go through the console screens for OSB service monitoring. Go to the OSB Services tab from OSB homepage, on that page you will see a listing of all the services that include proxy as well as business services.
You will see every proxy and business services is part of some project. OSB provides a construct project under which different services can be created; project is just a means to categorize different services.
The following screenshot shows such a page where you can see the list of all the projects and services. For each service you see metrics related to throughput, errors, violations, and performance.
Once you click on one of the services, you will see a page where the metrics and other details of proxy service are listed. On this page, you can see the throughput and performance chart for the proxy service. You will also see a section for the EM service model that represents a proxy service. This model is similar to the model that we had for the BPEL process. This mode has three entities:
- Infrastructure service: This service represents all of the components in the OSB eco system.
- Availability service: This service represents all of the availability tests for an OSB proxy service endpoint, it could include SOAP tests, Web transactions etc.
- Aggregate service: This service is just an aggregate of the previous two services. Using this service, you can monitor all of the required metrics in one place. You can see the performance of your IT infrastructure as well as the performance of partner links in one place.
The next screenshot shows such a page where you can see the details of the OSB service:
On the same screen, you will see the routing details that show what all business services are getting called from this proxy service. These details are listed under the references section. You will see the status of proxy service endpoint and business service endpoint. Other details available from this page include protocol, endpoint of proxy/business service. The next screenshot shows one such page. From this page, you can add SOAP test for OSB proxy service endpoint and business service end point. These SOAP tests are added to the availability service that we have discussed earlier:
From the Details tab on the same page, you can see the performance and throughput metrics at each individual step in the message flow. For each decision point, transformation, routing, and so on, you can see some useful metrics on this page. The screenshot below shows a listing of steps and metrics for each step.
These metrics include the number of messages processed, number of errors, and average performance time for processing of each message.
Monitoring business services
Business service routes the request to services implemented somewhere else. In some cases, these services could be out of your business unit or even organization; in other cases, it could be some service providers for you. For some important services, you might already have some Service Level Agreements defined therefore, for these services it is very important to measure the performance of OSB business services.
Enterprise Manager collects some very useful metrics for business services, which are:
- Status of business service endpoint
- Throughput metrics at business service and endpoint level
- Performance metrics at business service level and endpoint level
- Error metrics at business level and end point level
- Security violation at business service level
The following screenshot shows the page where you can see metrics for business services:
We defined the EM model for monitoring OSB service, where we had one aggregate service that was composed of infrastructure service and availability service. SOAP test for business services are added to same availability service. So, availability service for OSB proxy service includes tests for proxy service and business service endpoint.
Configuration management for Oracle Service Bus
OSB configuration collections from Enterprise Manager include following configuration parameters:
- Configuration for proxy services: It includes a flag for enabling tracing, monitoring, and metric aggregation intervals
- Configuration for business services: It includes a flag for enabling tracing, monitoring, and metric aggregation intervals
- Configuration for business service transport: Load-balancing algorithm, transport type
To see the collected configuration, click on the View Configuration link on the OSB homepage. We'll leave it as an exercise for you to complete. You can also compare the configuration of one OSB with another OSB, this is also very similar to the configuration of BPEL PM—we will leave that as an exercise for you to complete too.
Lifecycle management for Oracle Service Bus
In this section, we will cover how to provision the OSB services.
In a development environment, developers can build new OSB services through Eclipse IDE or through the OSB administration console. The OSB administration console is a web-based application for OSB configuration and it can also be used to define new OSB services.
To deploy OSB services in a staging or production environment, administrator needs to extract services from the development environment and deploy them to the production environment. Besides deployment in new environment, administrators may need some environment-specific customizations on the services.
Enterprise Manager provides deployment procedures and using which you can:
- Extract OSB services from a reference environment and build gold image
- Provision new OSB service from a reference environment, and apply customizations
- Provision new OSB service from gold image and apply customizations
How to use this feature
- Go to the Deployments tab on the Enterprise Manager homepage. On this page click on the Deployment Procedures link.
- On th e next page, you will see a list of all deployment procedures. Search for the deployment procedure by the name Oracle Service Bus Resource Provisioning.
- From the search results, select the radio button next to Oracle Service Bus Resource Provisioning, and click on the Schedule Deployment…button on top of the table.
- This will start a wizard to provision OSB services. The first screen of this wizard is shown below, where you will need to provide the source for provisioning, it could be a reference environment or a software library.
- In the second step, you will be asked to select the projects that you want to migrate from the source domain. You can select only at Project level, all of the services under a project will be selected. The screenshot below shows such a page:
- In the third step you will be asked to provide the destination domain where you want to deploy the project and services selected in the previous screen. You can also select the customization file that you want to apply after migrating the services.
- There are other options for advanced cases, but for this exercise you can ignore them. The following screenshot shows such a page.
- On the next two screens you will be asked to provide host and domain credentials for the source and destination domain, and a schedule for deployment.
- On the final screen you can review all the selections made so far and submit the deployment procedure. Once the deployment procedure is completed, the selected projects will be deployed in the destination domain at scheduled time.
OSB best practices
- Monitor the whole OSB eco system not just the OSB
- Monitor the availability and performance of proxy service endpoints and business service endpoints
- Define the threshold for metrics at endpoints and flow components
- Keep the gold image of configuration—it will help in troubleshooting
- Keep OSB projects and customization files in the software library and use deployment procedures to deploy the OSB projects
In this article we learnt about complexity in managing Oracle Service Bus. Through some exercises we saw how EM can simplify these complexities. The key takeaways are:
- OSB is used to integrate disparate services.
- We need to manage the whole OSB eco system, as the availability and performance of OSB is dependent on the availability and performance of any related component.
- You can do basic monitoring of OSB services using metrics. For OSB we have metrics at proxy service, business service, and message flow level.
- For advanced monitoring you need to monitor performance of proxy, business service endpoints and BPEL eco system. Enterprise Manager provides a model to support that.
- Enterprise Manager provides very fine-grained metrics for message flow, where throughput, and error metrics are available for each step in message flow.
- You can use configuration management to keep track of configuration changes.
- The software library can be used to keep OSB resources and customization files.
- You can use deployment procedures for moving OSB services from one environment to another environment.