Databases Reference
In-Depth Information
Creating the event
We create the event in Java by using the
oracle.integration.platform.blocks.
event.BusinessEventBuilder
class. An instance of this class is created by a
static factory method called
newInstance
. We need to provide a qualified name
(QName that includes the namespace and the entity name) and a body for the event
through setter methods on the
builder
class. Once these have been set, we can call
createEvent
to generate an instance of a
BusinessEvent
.
BusinessEventBuilder builder = BusinessEventBuilder.newInstance();
QNamename=newQName(
"http://schemas.oracle.com/events/edl/AuctionEventDefinitions",
"NewAuctionEvent");
builder.setEventName(name);
XMLElementcontent=…
builder.setBody(content);
BusinessEvent event = builder.createEvent();
The event name is a combination of the event schema, acting as an XML namespace,
and the event name. The content is the XML element containing the event content.
Once we have a
BusinessEvent
, we need a connection to the Event Delivery
Network in order to publish the event.
Creating the event connection
The event connection can be created using either a JMS queue connection
to the Event Delivery Network or an Oracle AQ connection. The latter
requires the use of a data source and is the approach we will show. We obtain
an
oracle.fabric.blocks.event.BusinessEventConnection
from a
BusinessEventConnectionFactory
. We will use the AQ version of this connection
factory, which is provided by the
oracle.integration.platform.blocks.event.
saq.SAQRemoteBusinessEventConnectionFactoryclass
.
DataSourceds=…
BusinessEventConnectionFactory factory = new
SAQRemoteBusinessEventConnectionFactory(ds, ds, null);
BusinessEventConnection conn =
factory.createBusinessEventConnection();
We use the connection factory to create a connection to Event Delivery Network.
The data source we provide must be configured to connect to the SOA infrastructure
schema in the database, which by default is called
<PREFIX>_SOAInfra
.