This chapter describes how to use the Event Inspector service to trace and inject events with any stage in the Event Processing Network (EPN), including:
Section 22.1, "Overview of Testing Applications With the Event Inspector"
Section 22.2, "Configuring the Event Inspector HTTP Pub-Sub Server"
Note:
The Event Inspector service is not for use on a production Oracle CEP server. It is for use only during development.Using the Event Inspector service, you can:
View the events flowing out of any stage in the EPN
Inject events into any stage in the EPN
You can use the Event Inspector service to test and debug Oracle CQL queries during development.
This section describes:
Using the Event Inspector service, you can view the events leaving any stage of the EPN.
The Event Inspector service uses a common HTTP pub-sub channel and server to trace events.
A trace event must have its binding
attribute set to outbound
.
For more information, see:
Using the Event Inspector service, you can inject events into any stage of the EPN.
The Event Inspector service uses a HTTP pub-sub channel and server to inject events.
An injected event must have its binding
attribute set to inbound
.
Using an Event Inspector client, you can inject:
A single, simple event by type, such as the StockTick
event.
In this case, the specific event property types that you can use depends on the client.
A single event directly to the HTTP pub-sub channel as a JSON-formatted character string.
In this case, you can use any event property that JSON can represent.
Multiple events using a file that contains one or more JSON-formatted character strings.
In this case, you can use any event property that JSON can represent. The Event Inspector service client will parse the file and inject all its JSON strings to the HTTP pub-sub channel.
You can use the GSON Java library to help you convert Java objects to JSON format when creating your input file.
For more information, see:
All Oracle CEP event types are supported: JavaBean, Java Class
, MapEvent
, and tuple.
The Event Inspector service converts events to the JavaScript Object Notation (JSON) format before publishing to the trace channel and you must inject events in JSON format.
JSON-formatted events must conform to the structure that Example 22-1 shows. Table 22-1
lists the required attributes.
Example 22-1 Event Inspector JSON Event
{ "event-type": "myEventType", "operation": "insert", "binding": "outbound", "value":{ "firstname": "Jane", "lastname": "Doe", "phone": { "code": 12345, "number": "office" }, } }
Table 22-1 Event Inspector JSON Event Required Attributes
Attribute | Description |
---|---|
The name of the Oracle CEP event as you defined it in the application assembly file's |
|
Specify the type of event:
|
|
One of:
|
|
One or more JSON-formatted event properties as defined by the |
For more information, see:
The Event Inspector service uses a dynamic HTTP publish-subscribe (HTTP pub-sub) channel (not configured in config.xml
) that is named:
/SERVERNAME/APPLICATIONNAME/STAGENAME/DIRECTION
Where:
SERVERNAME
: the name of the Oracle CEP server on which the Oracle CEP EPN stage is running.
APPLICATIONNAME
: the name of the Oracle CEP application.
STAGENAME
: the name of the EPN stage.
DIRECTION
: one of either:
input
: for event injection.
output
: for event tracing.
For example:
/server-1/myapp/MyInputAdapter/input
The Event Inspector service uses an HTTP pub-sub server. This can be any of:
Local: you configure your config.xml
file with an event-inspector-service
element and configure its pubsub-server-name
child element with the name of local pubsub server running on this machine. For more information, see Section 22.2.1, "How to Configure a Local Event Inspector HTTP Pub-Sub Server".
Remote: you configure your config.xml
file with an event-inspector-service
element and configure its pubsub-server-url
child element with a URL to an HTTP pub-sub server running on a remote machine. For more information, see Section 22.2.2, "How to Configure a Remote Event Inspector HTTP Pub-Sub Server".
Default: if there is only one HTTP pub-sub server defined in your config.xml
file and you do not specify a local or remote HTTP pub-sub server, then the Event Inspector service uses the local HTTP pub-sub server by default.
The Event Inspector service uses the same HTTP pub-sub channel and server for both tracing and injecting events.
For more information, see:
The Event Inspector service supports the following clients:
You can access the Event Inspector service using the Oracle CEP Visualizer.
For more information, see "Testing Applications With the Event Inspector" in the Oracle CEP Visualizer User's Guide.
You can configure the Event Inspector service with a local or remote HTTP pub-sub server:
Section 22.2.1, "How to Configure a Local Event Inspector HTTP Pub-Sub Server"
Section 22.2.2, "How to Configure a Remote Event Inspector HTTP Pub-Sub Server"
You configure the Event Inspector HTTP pub-sub server in a component configuration file. For general information about these configuration files, see Section 1.1.5, "Component Configuration Files."
If there is only one HTTP pub-sub server defined in your config.xml
and you do not specify a local or remote HTTP pub-sub server, then the Event Inspector service uses the local HTTP pub-sub server by default. For more information, see Chapter 7, "Configuring HTTP Publish-Subscribe Server Adapters".
You configure the Event Inspector service with a local HTTP pub-sub server in a component configuration file. Alternatively, you can configure a remote HTTP pub-sub server as Section 22.2.2, "How to Configure a Remote Event Inspector HTTP Pub-Sub Server" describes.
To configure a local Event Inspector HTTP pub-sub server:
Open the EPN editor in the Oracle CEP IDE for Eclipse.
Right-click any component with a configuration file associated with it and select Go to Configuration Source.
Add an event-inspector-service
element as Example 22-2 shows.
Example 22-2 Event Inspector Service Local HTTP Pub-Sub Server
<event-inspector-service> <name>myEventInspectorConfig</name> <pubsub-server-name>myPubSub</pubsub-server-name> </event-inspector-service>
Where the pubsub-server-name value myPubSub
is the value of the http-pubsub
element name
child element as defined in the local Oracle CEP server config.xml
file as Example 22-3 shows.
Example 22-3 Oracle CEP Built-In HTTP Pub-Sub Server http-pubsub Element
... <http-pubsub> <name>myPubSub</name> <path>/pubsub</path> <pub-sub-bean> <server-config> <supported-transport> <types> <element>long-polling</element> </types> </supported-transport> <publish-without-connect-allowed>true</publish-without-connect-allowed> </server-config> <channels> ... </channels> </pub-sub-bean> </http-pubsub> ...
Save and close the config.xml
file.
You configure the Event Inspector service with a remote HTTP pub-sub server in a component configuration file. Alternatively, you can configure a local HTTP pub-sub server as Section 22.2.1, "How to Configure a Local Event Inspector HTTP Pub-Sub Server" describes.
To configure a Remote Event Inspector HTTP pub-sub server:
Open the EPN editor in the Oracle CEP IDE for Eclipse.
Right-click any component with a configuration file associated with it and select Go to Configuration Source.
Add an event-inspector-service
element as Example 22-4 shows.
Example 22-4 Event Inspector Service Remote HTTP Pub-Sub Server
<event-inspector-service> <name>myEventInspectorConfig</name> <pubsub-server-url>http://HOST:PORT/PATH</pubsub-server-url> </event-inspector-service>
Where:
HOST
: is the host name or IP address of the remote Oracle CEP server.
PORT
: the remote Oracle CEP server netio
port as defined in the remote Oracle CEP server config.xml
file. Default: 9002.
PATH
: the value of the http-pubsub
element path
child element as defined in the remote Oracle CEP server config.xml
file.
Given the http-pubsub
configuration that Example 22-3 shows, a valid
pubsub-server-url
would be:
http://remotehost:9002/pubsub
Example 22-5 Oracle CEP Built-In HTTP Pub-Sub Server http-pubsub Element
... <http-pubsub> <name>myPubSub</name> <path>/pubsub</path> <pub-sub-bean> <server-config> <supported-transport> <types> <element>long-polling</element> </types> </supported-transport> <publish-without-connect-allowed>true</publish-without-connect-allowed> </server-config> <channels> ... </channels> </pub-sub-bean> </http-pubsub> ...
Save and close the config.xml
file.
After you configure the Event Inspector service HTTP pub-sub server, you can use Event Inspector clients to inject events.
This section describes how to use Event Inspector service clients to inject events, including:
For more information, see:
You can use the Oracle CEP Visualizer to inject events into any stage of your EPN.
For more information, see:
"How to Inject a Simple Event on an Event Inspector Service Dynamic Channel" in the Oracle CEP Visualizer User's Guide
"How to Inject an Event as a JSON String on an Event Inspector Service Dynamic Channel" in the Oracle CEP Visualizer User's Guide
After you configure the Event Inspector service HTTP pub-sub server, you can use Event Inspector clients to trace events.
This section describes how to use Event Inspector service clients to trace events, including:
For more information, see:
You can use the Oracle CEP Visualizer to trace events flowing out of any stage of your EPN.
For more information, see:
"How to Trace Events on a Dynamic Channel" in the Oracle CEP Visualizer User's Guide