In the first part we created an AQ queue and posted a sample message
into the queue.
In this part we will develop a soa composite to post message into AQ queue.
Before we start creating SOA composite, we first need to configure server resource to access AQ from SOA. We will need a datasource which connects to the database and an AQ outbound connection pool which we will use in our project.
we will create a bpel with exposed webservice to post message to AQ.
In our previous post while object for the queue we gave employee_id, employee_number
In this part we will develop a soa composite to post message into AQ queue.
Before we start creating SOA composite, we first need to configure server resource to access AQ from SOA. We will need a datasource which connects to the database and an AQ outbound connection pool which we will use in our project.
we will create a bpel with exposed webservice to post message to AQ.
In our previous post while object for the queue we gave employee_id, employee_number
create
or replace type employee_type as object(
employee_id
number,
employee_number
varchar2(60),
employee_name
varchar2(60)
);
Let’s create a new application for this
example:
Create an empty soa project:
Now first we need to create a schema file, as
we are going to expose our BPEL as a web service, we will need to enter our
input there which will later on be inserted into AQ.
Click on New and select XML Schema:
As we have specified 3 parameters(employee id,
employee number and employee name) while creating AQ, in our input schema also
we will give these 3 inputs to make things simple.
So let’s create an incoming schema.
<?xml version="1.0"
encoding="windows-1252" ?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
elementFormDefault="qualified">
<xsd:element name="Employee">
<xsd:annotation>
<xsd:documentation>
A
sample element
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="EmployeeID"
type="xsd:integer"/>
<xsd:element name="EmployeeNumber" type="xsd:string"/>
<xsd:element name="EmployeeName"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Now create a new bpel process and expose it as
a web service, we will create a one way bpel as we do not expect any response,
this process will just put message into AQ Queue, we will select the input as
the schema element we just created.
Next step is to configure AQ Adapter.
The JNDI name will be the connection pool name
created in weblogic console, which will point to the data source which will
ultimately point to the database in which our queue is present:
We will define our outgoing schema from the
fields present in queue.
As we have created a single consumer queue hence
our queue is appearing in single consumer section.
If we create a multi consumer queue then it
will appear in multi consumer section. The only difference from SOA point of
view will be, while creating AQ adapter connection we will have to give the
subscriber name used while creating the queue as the consumer name, which will
appear in our .jca file.
We can see 3 new files got added in our project,
an outgoing schema has been generated as per the fields present in the AQ
queue:
Now the only thing left is to connect the dots J
Add an invoke to AQ Adapter, create a variable,
and create a transformation from input variable to AQ Adapter variable.
Our code is ready now, deploy and test. This process
will post the message into AQ Queue.
You can check the posted message In the queue:
SELECT * FROM aq$employee_queue_table;
user_data field gives the actual message:
SELECT user_data FROM aq$employee_queue_table;
Good creation ,thanks for good info Oracle SOA Online Training
ReplyDelete