Skip Headers
Oracle® Fusion Middleware Developer's Guide for Oracle Complex Event Processing
11g Release 1 (11.1.1.6.3) for Eclipse

Part Number E14301-10
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

26 Testing Applications With the Event Inspector

This chapter describes how to use the Event Inspector service to trace and inject events with any stage in an Oracle Complex Event Processing (Oracle CEP) event processing network (EPN).

Note:

The Event Inspector service is not for use on a production Oracle CEP server. It is for use only during development.

26.1 Overview of Testing Applications With the Event Inspector

Using the Event Inspector service, you can:

You can use the Event Inspector service to test and debug Oracle CQL queries during development.

This section describes:

For more information on testing and debugging, see Section 5.4, "Debugging an Oracle CEP Application Running on an Oracle CEP Server".

26.1.1 Tracing Events

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:

26.1.2 Injecting Events

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:

26.1.3 Event Inspector Event Types

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 26-1 shows. Table 26-1 lists the required attributes.

Example 26-1 Event Inspector JSON Event

{
    "event-type": "myEventType",
    "operation": "insert",
    "binding": "outbound",
    "value":{
        "firstname": "Jane",
        "lastname": "Doe",
        "phone": {
            "code": 12345,
            "number": "office"
        },
    }
}

Table 26-1 Event Inspector JSON Event Required Attributes

Attribute Description

event-type

The name of the Oracle CEP event as you defined it in the application assembly file's event-type-repository.

operation

Specify the type of event:

  • insert: insert event.

  • delete: delete event

  • update: update event

  • heartbeat: heartbeat event

binding

One of:

  • inbound: injected event.

  • outbound: trace event.

value

One or more JSON-formatted event properties as defined by the event-type.


For more information, see:

26.1.4 Event Inspector HTTP Publish-Subscribe Channel and Server

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 26.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 26.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:

26.1.5 Event Inspector Clients

The Event Inspector service supports the following clients:

26.1.5.1 Oracle CEP Visualizer

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 Fusion Middleware Visualizer User's Guide for Oracle Complex Event Processing.

26.2 Configuring the Event Inspector HTTP Pub-Sub Server

You can configure the Event Inspector service with a local or remote 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 8, "Configuring HTTP Publish-Subscribe Server Adapters".

26.2.1 How to Configure a Local Event Inspector HTTP Pub-Sub Server

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 26.2.2, "How to Configure a Remote Event Inspector HTTP Pub-Sub Server" describes.

To configure a local Event Inspector HTTP pub-sub server:

  1. Open the EPN editor in the Oracle CEP IDE for Eclipse.

    See Section 6.1, "Opening the EPN Editor".

  2. Right-click any component with a configuration file associated with it and select Go to Configuration Source.

  3. Add an event-inspector-service element as Example 26-2 shows.

    Example 26-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 26-3 shows.

    Example 26-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>
    ...
    
  4. Save and close the config.xml file.

26.2.2 How to Configure a Remote Event Inspector HTTP Pub-Sub Server

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 26.2.1, "How to Configure a Local Event Inspector HTTP Pub-Sub Server" describes.

To configure a Remote Event Inspector HTTP pub-sub server:

  1. Open the EPN editor in the Oracle CEP IDE for Eclipse.

    See Section 6.1, "Opening the EPN Editor".

  2. Right-click any component with a configuration file associated with it and select Go to Configuration Source.

  3. Add an event-inspector-service element as Example 26-4 shows.

    Example 26-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 26-3 shows, a valid pubsub-server-url would be:

    http://remotehost:9002/pubsub
    

    Example 26-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>
    ...
    
  4. Save and close the config.xml file.

26.3 Injecting Events

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:

26.3.1 How to Inject Events Using Oracle CEP Visualizer

You can use the Oracle CEP Visualizer to inject events into any stage of your EPN.

For more information, see:

26.4 Tracing Events

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:

26.4.1 How to Trace Events Using Oracle CEP Visualizer

You can use the Oracle CEP Visualizer to trace events flowing out of any stage of your EPN.

For more information, see: