Configuring AQ Database Objects, JDBC Data Source and AQ Adapter Connection – Complement to Chapter 6

In Chapter 6, we introduce the AQ Adapter for outbound interaction with (i.e. publication to) an Advanced Queue in an Oracle Database. This article provides supporting details for the configuration of the AQ objects in the database as well as the WebLogic configuration of JDBC Data Source and AQ Adapter connection.

This article is supported by another article about the preparation of the database for the Saibot Airport demo environment.

Create Database User with Appropriate Privileges

The referenced article provides the scripts for creating the user (as SYS, SYSTEM or some other DBA user) and the AQ objects themselves. Here are screenshots of executing the two sets of statements:

and creating the AQ itself:

Configure the JDBC Data Source for the SAIBOT_FINANCE schema

Configuring a JDBC data source is done in the WebLogic Admin Console. This data source should have a JNDI name set to jdbc/SaibotFinanceDS.

 

 

 

 

Configuration of the AQ Adapter Connection

Find the AQ Adapter deployment in the summary of deployments.

Click on this deployment to go to the Settings. Open the Configuration tab and within that the Outbound Connections Pool.

Click on the New button, to create a new connection.

Another two step wizard, in which you accept the default and only Outbound Connection Group on the first page and set the JNDI name for this new connection on the second page.

This name will be referenced from the outbound Adapter binding in the service implementation. Set the name to eis/aq/SaibotFinance.

Press Finish to complete the creation of the connection.

The Save Deployment Assistant may appear, to have these changes in the configuration of the AQ Adapter saved in a new deployment plan. Set the name of the plan to AQPlan.xml and press OK to have the plan saved.

Next, return to the Properties tab for the connection.

The DataSourceName or XADataSourceName (depending on how you created the data source – XADataSource if you accepted the default driver) property has to be set with the JNDI name of the data source:

.

Press enter and press the Save button.

 

Now to ensure the new AQ Adapter connection is available for use, update the AqAdapter deployment, as shown in Figure 6-32.

Press Next, then Finish.

Alternative implementation of AircraftMovementService with JCA JMS Adapter in SOA composite application – Complement to Chapter 6

The JCA adapter for JMS is also available with SOA composites, but the JMS Transport is not. Creating a SOA composite that is functionally equivalent to the AircraftMovementService Service Bus project

turns out very simple indeed, using the exact same JCA Adapter configuration. The steps for this :

  1. Create a SOA composite project – for example called AircraftMovementServiceSOAcomposite. Select the application template with Mediator. Call the Mediator AircraftMovementMediator. Define the interface later.
  2. Copy the AircraftMovementService.wsdl plus the associated XSDs from the AircraftMovementService Service Bus project to the folders WSDLs and Schemas respectively in the SOA composite project.
  3. Open the editor for the mediator component. Click on the green plus icon for the WSDL URL and select the AircraftMovementService.wsdl file, to indicate that the mediator exposes the AircraftMovementsServicePortType interface.
  4. Drag the exposed service from the mediator and drop it on the Exposed Services lane, thus creating the composite level service interface.
  5. Drag the JMS adapter from the Technology category in the components palette and drop it in the External References lane.
  6. The by now familiar JMS Adapter configuration wizard appears. Set the same values as before, in the context of the Service Bus composite.

    The name of the reference is FinanceAircraftMovementsReporterJCA.

    Select the Oracle Enterprise Messaging Service JMS provider and specify the Oracle WebLogic JMS option on page two.

    Select the AppServer connection to the Integrated WLS.
    Select Import an existing WSDL and use AircraftMovementService.wsdl.

    Set the Operation Type to Produce Message.


    On the Produce Operation Parameters page, browse for jms/finance/AircraftMovementsQueue for the Destination Name. Accept the defaults for Message Body Type (Text Message) and Delivery Mode (Persistent). Set the TimeToLive to 15 seconds. Set the JNDI Name [of the JMS Adapter Connection] to eis/Finance/Queue.




    Accept other defaults and then click Finish to complete the adapter’s configuration.

  7. Wire the mediator component to the JMS Adapter binding. This creates a routing rule in the mediator that routes request messages arriving at the exposed AircraftMovementService’s reportAircraftMovement operation to the report operation on the FinanceAircraftMovementsReporterJCA outbound adapter binding.

This completes the SOA composite.

Deploy the composite. Then test the service, for example through the EM FMW Control.

Configuring the Outbound JMS Adapter Binding FinanceAircraftMovementsReporterJCA – Complement to Chapter 6

The starting point for this article is the following Service Bus project that has a JMS Transport configured to connect to the financial JMS queue, as described in the second section of Chapter 6.

We are now going to extend this project with a JCA JMS Adapter binding that does exactly the same thing – purely for educational purposed (note that JMS Transport is the preferred option according to Oracle SOA Suite product management for Service Bus projects).

Drag the JCA JMS Adapter from the Advanced category to the External References lane. When you drop it, the adapter configuration wizard appears, to configure the JMS Adapter binding.

On the first page, set the name of the Reference to FinanceAircraftMovementsReporterJCA. Set the Service Directory to the Adapters folder.

Click Next.

Select the Oracle Enterprise Messaging Service JMS provider and specify the Oracle WebLogic JMS option on page two.

Press Next.

On the third page, select the AppServer connection to the Integrated WLS (if that is the environment you are running on). This connection is used to browse for the JMS Adapter connection and the JMS queue – the JNDI names of which can also be entered manually.

Press Next. Select Import an existing WSDL and select the AircraftMovementService.wsdl as the source.

Press Next.

On the Operation page, set the Operation Type to Produce Message. The name of the operation is derived from the WSDL and is set to reportAircraftMovement.

The next page of the wizard (Figure 6-20) is titled Produce Operation Parameters. Set the Destination Name to the JNDI name of the JMS queue the adapter binding should publish messages to: jms/finance/AircraftMovementsQueue. Accept the defaults for Message Body Type (Text Message) and Delivery Mode (Persistent). Set the TimeToLive to 15 seconds.

The JNDI Name [of the JMS Adapter Connection] should be set to eis/Finance/Queue – the name specified for the new connection that was configured for the JMS Adapter.

Press Next.

In the next page, if we have not yet defined the Adapter Interface, we can specify the format of the messages that the JMS Adapter should pass onwards to the JMS queue. Checking the checkbox Native format translation is not required (Schema is Opaque) is used when a base64 payload should be passed. Alternatively, we can specify a native XSD definition for whatever format the JMS message payload should have. In this case, the WSDL specifies the reportAircraftMovementRequestMessage and this page in the wizard is disabled.

Press Next,

then press Finish to complete the configuration of the outbound JMS Adapter binding.

JDeveloper will create a business service with JCA transport that references the JMS Adapter binding configuration file FinanceAircraftMovementsReporterJCA.jca.

You can test this business service – by activating the run option in the context menu on the business service in the Service Bus composite overview.

Implementing the AirportService ProxyService and Pipeline on top of Database Adapter – Chapter 4

This article visualizes the steps for implementing the AirportService Service Bus project as described in the first section of Chapter 4 (see the chapter for the detailed description of the steps)

Wire Pipeline to Business Service:

 

 

 

Create Transformations for request and response:

Configure Replace actions to perform the transformations using the XSL Maps:

Run the Proxy Service to test the service:

 

Configuring Outbound Database Adapter binding for Data Querying – Chapter 4

This article shows the detail steps that are described in Chapter 4 – Section Retrieving information from the database. This article assumes that the setup of the database has been done according to: http://blog.soasuitehandbook.org/preparing-the-saibot-airport-database-for-the-oracle-soa-suite-12c-handbook/ .

First design time, in JDeveloper.

Configure JDBC Data Source to the SAIBOT database schema

Specify the Managed Server(s) to which the Data Source should be deployed:

Configure Database Adapter Connection

Now configure the DB Adapter Connection with a reference to the JDBC Data Source that we created earlier on to connect to the Saibot Database schema.

You may have to Stop and Start the Database Adapter for this configuration to have effect. You may even have to bounce the managed server. I have seen different behavior – and none seem predictable.

Test the Business Service from JDeveloper or the Service Bus Console:

This response to a test of the Business Service indicates that a restart is needed:

The proper response will look like this:

Preparing the SAIBOT AIRPORT Database for the Oracle SOA Suite 12c Handbook

Some of the chapters in the Oracle SOA Suite 12c Handbook include code examples that use the Database Adapter and require some preparation. This article helps you perform the necessary steps.

To make things easy, we will create all database objects in a single database schema – even though logically the SAIBOT AIRPORT database is more complex than that. Note that an Oracle XE database will suffice for the samples in the book – and is therefore probably preferable given its small footprint.

Using a database account with DBA privileges – such as SYSTEM OR SYS when using a local database – create a new user with a number of privileges using the following statements:

create user saibot identified by saibot default tablespace users temporary tablespace temp; alter user saibot quota unlimited on  users ; grant connect, create table, create procedure, create sequence, create type to saibot;

Chapter 3

Chapter 3 requires the creation of a number of tables – for AIRPORTS and COUNTRIES – with a minimum of prepopulated records; these tables can be created using this script.

Slightly more complex is the creation of a PL/SQL package FUT_SLOT_API and a number of types and tables. These objects are logically part of the Future data domain with details about slots and flights that are planned to take place. The package and its supporting types and tables can  be created using this script.

Chapter 6

In this chapter, Advanced Queuing is used. The AQ configuration can be done in the saibot schema introduced overhead or in a new schema. This new schema can be  created using the following statements, by a user with DBA privileges – such as SYSTEM OR SYS when using a local database:

create user saibot_finance identified by saibot_finance default tablespace users temporary tablespace temp;
alter user saibot_finance quota unlimited on users;
grant create session to saibot_finance;
grant create type to saibot_finance;
grant aq_administrator_role to saibot_finance;
EXECUTE dbms_aqadm.grant_type_access('saibot_finance');

Alternatively, additional privileges can be granted to the user saibot:

grant aq_administrator_role to saibot;
EXECUTE dbms_aqadm.grant_type_access('saibot');

The statements to create type aircraft_movement_report_t and configure queue aircraft_movements_queue on top of queue table saibot_finance.aircraft_movements_qt can be found in this script that is on Github in the source code repository for this book.

SOA Suite 12c: Using Enterprise Scheduler Service to schedule deactivation and activation of inbound adapter bindings

The Enterprise Scheduler Service that is available in Fusion Middleware 12.1.3 supports a number of administration activities around the SOA Suite. We will look at one particular use case regarding environment management using the ESS. Suppose we have an inbound database adapter. Suppose we have created the PortalSlotRequestProcessor SOA composite that uses a database poller looking for new records in a certain table PORTAL_SLOT_ALLOCATIONS (this example comes from the Oracle SOA Suite 12c Handbook, Oracle Press). The polling frequency was set to once every 20 seconds. And that polling goes on and on for as long as the SOA composite remains deployed and active.

Imagine the situation where every day during a certain period, there is a substantial load on the SOA Suite, and we would prefer to reduce the resource usage from non-crucial processes. Further suppose that the slot allocation requests arriving from the portal are considered not urgent, for example because the business service level agreed with our account managers is that these requests have to be processed within 24 hours – rather than once every 20 seconds. We do not want to create a big batch, and whenever we can, we strive to implement straight through processing. But between 1 and 2 AM on every day, we would like to pause the inbound database adapter.

In this section, we will use the Enterprise Scheduler Service to achieve this. We will create the schedules that trigger at 1 AM every day, used for deactivating the adapter, and 2 AM, used for activating the adapter. In fact, in order to make testing more fun, we will use schedules that trigger at 10 past the hour and 30 past the hour. These schedules are then associated in the Enterprise Manager Fusion Middleware Control with the inbound database adapter binding PortalSlotRequestPoller.

Create Schedules

An ESS Schedule is used to describe either one or a series of moments in time. A schedule can be associated with one or many Job definitions to come to describe when those jobs should be executed. A recurring schedule has a frequency that describes how the moments in time are distributed over time. A recurring schedule can have a start time and an end time to specify the period during which the recurrence should take place.

To create the schedules that will govern the inbound database adapter, open the EM FMW Control and select the node Scheduling Services | ESSAPP. From the dropdown list at the top of the page, select Job Requests | Define Schedules, as is shown in this figur

 

image

Click on the icon to create a new schedule. Specify the name of the schedule as At10minPastTheHour. Set the display name to “10 minutes past each hour”. The schedule has to be created in the package [/oracle/apps/ess/custom/]soa. This is a requirement for schedules used for adapter activation.

Select the frequency as Hourly/Minute, Every 1 Hour(s) 0 Minute(s) and the start date as any date not too far in the future (or even in the past) with a time set to 10 minutes past any hour.

image

Note that using the button Customize Times, we can have a long list of moments in time generated and subsequently manually modify them if we have a need for some exceptions to the pattern.

Click on OK to save this schedule.

Create a second schedule called At30minPastTheHour. The definition is very similar to the previous one, except for the start time that should 30 minutes past some hour.

image

Click OK to save this schedule definition.

Note that more sophisticated recurrence schedules can be created through the Java API exposed by ESS as well as through the IDE support in JDeveloper. These options that allow specific week days or months to be included or excluded can currently not set set through the EM FMW Control.

Apply Schedules for Activation and Deactivation of Inbound Database Adapter

Select node SOA | soa-infra | default | PortalSlotRequestProcessor – the composite we created in the previous chapter. Under Services and References, click on the PortalSlotRequestPoller, the inbound database adapter binding.

clip_image002

The PortalSlotRequestProcessor appears. Click on the icon for adapter schedules.

image

In the Adapter Schedules popup that appears, we can select the schedule that is to be used for deactivating and for activating the adapter binding. Use the At10minPastTheHour schedule for deactivation and At30minPastTheHour for activation. Press Apply Schedules to confirm the new configuration.

clip_image003

From this moment on, the inbound database adapter binding that polls table PORTAL_SLOT_ALLOCATIONS is active only for 40 minutes during every hour, starting at 30 minutes past the hour.

For example, at 22:14, the binding is clearly not active.

image

 

Test switching off and on of Database Adapter binding

When the schedules for activation and deactivation have been applied, they are immediately in effect. You can test this in the Dashboard page for the inbound database adapter binding, as is shown here

clip_image002[5]

Here we see how a single record was processed by the adapter binding, insert at 10:09PM. Four more records were inserted into table PORTAL_SLOT_ALLOCATIONS at 10:13 and 10:14. However, because the adapter binding is currently not active, so these records have not yet been processed.

image

image

At 30 minutes past the hour – 10:30 in this case – the adapter becomes active again and starts processing the records it will then find in the table. Because the adapter was configured to pass just a single record to a SOA composite and not process more than two records in a single transaction, it will take two polling cycles to process the four records that were inserted between 10:10 and 10:30. These figures illustrate this.

image

image

clip_image004

 

The SOA composite instances that are created for these four records retrieved in two poll cycles:

image

and the flow trace for the instance at 10:30:09 looks like this – processing two separate database records:

imageWhen you check in the ESS UI in EM FMW Control, you will find two new Job Definitions, generic Jobs for executing SOA Suite management stuff:

ess_adapteractivation1

In the Job Requests overview, instances of these jobs appear, every hour one of each. And the details of these job requests specify which adapter binding in which composite is the target of the SOA administrative action performed by the job.

ess_adapteractivation2

Setup for JMS resources in WebLogic (Chapter 6)

In Chapter 6, the use of the outbound JMS Adapter in SOA Suite is described. In order to implement the services described in the chapter, some setting up of JMS resources is required in your WebLogic Server. This article describes the steps you need to go through in terms of preparation, resulting in a JMS queue with a JNDI name of jms/finance/AircraftMovementsQueue in the SOAJMSModule and a Connection Factory called jms/finance/FinanceConnectionFactory in that same JMS Module.

Note: in real life you should be creating your own JMS Module instead of using the SOAJMSModule that SOA Suite uses itself. In the context of the book, to keep things simple, we will violate that rule.

Lees verder

Configuring Chat in SOA Suite 12c with the XMPP driver in the UMS Adapter

Chatting or instant messaging is a valuable for of communication, somewhere between email (very asynchronous) and telephone/Skype/VoiP/HangOut (synchronous) and quite similar to SMS. Unfortunately, there is has been an explosion in the number of IM protocols and services, many of which cannot talk to each other. Whatsapp is perhaps the most popular chat-like service, but it lives on its own. Google Talk (now assimilated into GMail and Google Hangouts) started as a relatively open service (based on the XMPP standard for IM), but is now largely proprietary. AOL, MSN, ICQ, Facebook, Skype, Twitter – many different largely closed networks within in which users can interact in char-style. But unfortunately hardly across which. Not like emails for example that float freely between domains, servers and vendor technologies.

Having said all that, XMPP is still supported by many tools and servers – and it is still used by large numbers of users. Not just for chatting, but for other types of push-style interaction. See this Slideshare presentation for a nice intro into XMPP. Note that it mentions some attempts to create gateways to connect the worlds of XMPP, Skype, AOL/AIM, IRC.

The goal of this article is not to commiserate over XMPP. It is to show you how SOA Suite can be configured to participate in XMPP based conversations – for now only as a sender of messages (we will discuss inbound integration with XMPP in a later article). In SOA Suite 12c, the functionality that was already available from the UMS (User Messaging Service) and the UMS Adapter in SOA Suite 11g has been continued and a little bit extended. I will show you what it looks like and how to make it to work.

Lees verder

Setup GMail as mail provider for SOA Suite 12c – configure SMTP certificate in trust store

On this subject, there are already many fine articles. I have borrowed from at least a dozen to understand what should happen and to make it work. You will find them listed under resources. I have collected wisdom from most of these and created a new description, that works for me and for SOA Suite 12c and will have you sending emails from the SOA Suite 12c through your GMail account in no time at all.

Lees verder