An HTTP Publish-Subscribe (HTTP pub-sub) server enables web clients to subscribe to channels and publish messages to the channels using asynchronous messaging over HTTP. You can configure an HTTP pub-sub server to subscribe to channels, use a specific type of transport, set a time out, indicate a specific work manager to deliver messages to clients, and so on.
This chapter includes the following sections:
Note:
The Oracle Event Processing server HTTP pub-sub server does not support Single Sign-On (SSO) using Security Assertion Markup Language (SAML). For more information on SSO and SAML, see SSO with SAML2.
Every Oracle Event Processing server has a default HTTP pub-sub server. Oracle Event Processing Visualizer and the Record and Playback sample application use the default HTTP pub-sub server internally. An installation can use the default HTTP pub-sub server, or have a software developer create a custom HTTP pub-sub server.
In Oracle Event Processing, HTTP pub-sub server instances are configured in the config.xml
file of the server instance. System administrator uses the config.xml
to configure the name of the HTTP pub-sub server, specify the transport and other parameters. An administrator then uses Oracle Event Processing Visualizer to add new channels and configure security for the channels. See Oracle Fusion Middleware Using Visualizer for Oracle Event Processing.
The <http-pubsub
> element in the config.xml
file contains the HTTP pub-sub server configuration. By default, the HTTP pub-sub server has the following configuration. See Oracle Fusion Middleware Schema Reference for Oracle Event Processingfor information about the supported configuration settings.
<http-pubsub> <name>pubsub</name> <path>/pubsub</path> <pub-sub-bean> <server-config> <name>/pubsub</name> <supported-transport> <types> <element>long-polling</element> </types> </supported-transport> <publish-without-connect-allowed>true</publish-without-connect-allowed> </server-config> <channels> <element> <channel-pattern>/evsmonitor</channel-pattern> </element> <element> <channel-pattern>/evsalert</channel-pattern> </element> <element> <channel-pattern>/evsdomainchange</channel-pattern> </element> </channels> </pub-sub-bean> </http-pubsub>
<path>/pubsub</path>: The URL to the HTTP pub-sub server. In a browser, you can locate the HTTP pub-sub server by typing http://
host
:
port
/pubsub
, where host
and port
refer to the computer on which Oracle Event Processing is running and the port number to which it listens, respectively. For example, http://myhost.com:9102/pubsub
.
<supported-transport>: The transport mode. The default is long-polling
transport.
<publish-without-connect-allowed>true</publish-without-connect-allowed>: Allows clients to publish messages to a channel without having to explicitly connect to the HTTP pub-sub server.
Includes the following three channels that are used internally by Oracle Event Processing Visualizer. Do not delete these channels:
/evsmonitor
/evsalert
/evsdomainchange
Oracle Event Processing provides two built-in adapters that provide HTTP pub-sub server functionality in applications. A software developer adds these adapters to an application to publish messages or subscribe to a server to receive messages.
In an application, a software developer uses the HTTP pub-sub adapters as follows:
Uses the HTTP Publisher adapter to send JavaScript Object Notation (JSON) event data out of the EPN to a web-based user interface.
Uses the HTTP Subscriber adapter to accept JavaScript Object Notation (JSON) event data entering the EPN. JSON event data comes from an HTTP server where user actions generate events.
If a software developer needs the HTTP pub-sub server to perform additional steps such as monitoring, collecting, or interpreting incoming messages from clients, then he or she must use the server-side HTTP pub-sub server APIs to program this functionality. See the following packages:
com.bea.wlevs.adapters.httppubsub.api
com.bea.wlevs.adapters.httppubsub.support
See Oracle Fusion Middleware Java API Reference for Oracle Event Processing.
The HTTP Publish-Subscribe server enables clients to subscribe to a channel (similar to a topic in JMS) and receive messages as they become available. In contrast traditional web applications require that all communication be initiated by the client. The server can only push updated data to its clients if it receives an explicit request. However, dynamic real-time applications require that the server send data regardless of whether the client explicitly requested it.
The HTTP pub-sub server is based on the Bayeux protocol proposed by the cometd project. The Bayeux protocol defines a contract between the client and the server for communicating with asynchronous messages over HTTP. It allows clients to register and subscribe to channels that are named destinations or sources of events. Registered clients, or the HTTP pub-sub server itself, then publishes messages to these channels which in turn any subscribed clients receive.
The HTTP pub-sub server can communicate with any client that can understand the Bayeux protocol. The HTTP pub-sub server is responsible for identifying clients, negotiating trust, exchanging Bayeux messages, and pushing event messages to subscribed clients. For Web 2.0 Ajax clients (such as Dojo) or rich internet applications (such as Adobe Flex) to communicate with the HTTP pub-sub server, the clients need a library that supports the Bayeux protocol. The Dojo JavaScript library provides four different transports, of which two are supported by the HTTP pub-sub server: long-polling and callback-polling.
There is a one-to-one relationship between a servlet and an HTTP pub-sub server. Each servlet has access to one unique HTTP pub-sub server. Each HTTP pub-sub server has its own list of channels. The servlet uses a context object to obtain a handle to its associated HTTP pub-sub server.
GUID-96A34843-25EF-4686-BD61-B444276286CE.htm#CEPAG-GUID-FFBDA472-C005-4E78-B5F2-9AEB1E804138__i1021635 shows the basic Oracle Event Processing HTTP pub-sub server architecture.
Figure 13-1 HTTP Publish-Subscribe Server in Oracle Event Processing
The following procedure describes how to create a new HTTP pub-sub server. See Default HTTP Pub-Sub Server for a full example from the config.xml
of a configured HTTP pub-sub server.
Create a New HTTP Publish-Subscribe Server
If the Oracle Event Processing server is running, stop it.
See "Start and Stop Servers".
In an XML editor, open the Oracle Event Processing server config.xml
file.
By default this file is in Oracle/Middleware/my_oep/user_projects/domains/<domainname>/<servername>/config
.
Add an http-pubsub
child element of the root config
element of config.xml
, with name
, path
and pub-sub-bean
child elements, as shown in bold:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:config xmlns:ns2="http://www.bea.com/ns/wlevs/config/server"> <domain> <name>myDomain</name> </domain> .... <http-pubsub> <name>myPubSubServer</name> <path>/myPath</path> <pub-sub-bean> ... </pub-sub-bean> </http-pubsub> ... </ns2:config>
Set the name
element to the internal name of the HTTP pub-sub server.
Set the path
element to the string that you want to appear in the URL for connecting to the HTTP pub-sub server.
The next step describes the pub-sub-bean
element.
Add server-config
and channels
child elements of the pub-sub-bean
element:
<http-pubsub> <name>myPubSubServer</name> <path>/myPath</path> <pub-sub-bean> <server-config> ... </server-config> <channels> ... </channels> </pub-sub-bean> </http-pubsub>
Update the server-config
child element of the pub-sub-bean
element with HTTP pub-sub server configuration as required.
For the full list of possible elements, see Oracle Fusion Middleware Schema Reference for Oracle Event Processing.
The following are the most common configuration options:
Add a supported-transport
element to specify the transport.
The format of this element is as follows:
<server-config> <supported-transport> <types> <element>long-polling</element> </types> </supported-transport> ... </server-config>
Oracle Event Processing server supports the following transports:
long-polling
: Using this transport, the client requests information from Oracle Event Processing server and if Oracle Event Processing server does not have information available, it does not reply until it has. When the Oracle Event Processing server replies, the client typically sends another request immediately.
callback-polling
: Use this transport for HTTP publish-subscribe applications using a cross domain configuration in which the browser downloads the page from one Web server (including the JavaScript code) and connects to another server as an HTTP publish-subscribe client. This is required by the Bayeux protocol.
Add a publish-without-connect-allowed
element to specify whether clients can publish messages without having explicitly connected to the HTTP pub-sub server; valid values are true
or false
:
<server-config> ... <publish-without-connect-allowed>true</publish-without-connect-allowed> </server-config>
Add a work-manager
element to specify the name of the work manager that delivers messages to clients. The value of this element corresponds to the value of the <name>
child element of the work-manager
you want to assign.
<server-config> ... <work-manager>myWorkManager</work-manager> </server-config>
See Oracle Fusion Middleware Schema Reference for Oracle Event Processing.
Add a client-timeout-secs
element to specify the number of seconds after which the HTTP pub-sub server disconnects a client if the client has not sent back a connect/reconnect message.
<server-config> ... <client-timeout-secs>600</client-timeout-secs> </server-config>
Update the channels
child element with at least one channel pattern.
Channel patterns always begin with a forward slash (/
). Clients subscribe to these channels to either publish or receive messages. Add a channel pattern as shown:
<channels> <element> <channel-pattern>/mychannel</channel-pattern> </element> </channels>
Save the config.xml
file.
Start the Oracle Event Processing server.
See "Start and Stop Servers".
Use Oracle Event Processing Visualizer to configure or add channels. See:
Use Oracle Event Processing Visualizer to configure security for the channels. See:
The following procedure describes how to configure an existing HTTP pub-sub server. See Default HTTP Pub-Sub Server for a full example from the config.xml
of a configured HTTP pub-sub server.
Configure an Existing HTTP Publish-Subscribe Server