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

Part Number E14301-09
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
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

22 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 Event Processing event processing network (EPN).

This chapter includes the following sections:

Note:

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

22.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 6.4, "Debugging an Oracle Event Processing Application Running on an Oracle Event Processing Server".

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

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

22.1.3 Event Inspector Event Types

All Oracle Event Processing event types are supported: JavaBean, Map, 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.

Note:

Byte arrays are not supported as property types in event types used with the event inspector.

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

event-type

The name of the Oracle Event Processing 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:

22.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 Event Processing server on which the Oracle Event Processing EPN stage is running.

  • APPLICATIONNAME: the name of the Oracle Event Processing 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 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 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:

22.1.5 Event Inspector Clients

The Event Inspector service supports the following clients:

22.1.5.1 Oracle Event Processing Visualizer

You can access the Event Inspector service using the Oracle Event Processing Visualizer.

For more information, see "Testing Applications With the Event Inspector" in the Oracle Fusion Middleware Visualizer User's Guide for Oracle Event Processing.

22.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.4.2, "Overview of 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 12, "Integrating an HTTP Publish-Subscribe Server".

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

  1. Open the EPN editor in the Oracle Event Processing IDE for Eclipse.

    See Section 7.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 element as Example 22-2 shows.

    Example 22-2 Event Inspector Service Local HTTP Pub-Sub Server

    <event-inspector>
        <name>myEventInspectorConfig</name>
        <pubsub-server-name>myPubSub</pubsub-server-name>
    </event-inspector>
    

    Where the pubsub-server-name value myPubSub is the value of the http-pubsub element name child element as defined in the local Oracle Event Processing server config.xml file as Example 22-3 shows.

    Example 22-3 Oracle Event Processing 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.

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

  1. Open the EPN editor in the Oracle Event Processing IDE for Eclipse.

    See Section 7.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 element as Example 22-4 shows.

    Example 22-4 Event Inspector Service Remote HTTP Pub-Sub Server

    <event-inspector>
        <name>myEventInspectorTraceConfig</name>
        <pubsub-server-url>http://HOST:PORT/PATH</pubsub-server-url>
    </event-inspector>
    

    Where:

    • HOST: is the host name or IP address of the remote Oracle Event Processing server.

    • PORT: the remote Oracle Event Processing server netio port as defined in the remote Oracle Event Processing server config.xml file. Default: 9002.

    • PATH: the value of the http-pubsub element path child element as defined in the remote Oracle Event Processing 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 Event Processing 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.

22.3 Injecting Events

After you configure the Event Inspector service HTTP pub-sub server, you can use Event Inspector clients to inject events. To configure event injection, you can use the Oracle Event Processing Visualizer or you can edit a component configuration file in your application to specify injection settings that are in place when the application is deployed or redeployed.

Configure event injection in Oracle Event Processing Visualizer with settings that can be discarded when the application is redeployed. For more information on using Oracle Event Processing Visualizer to inject events, see "How to Inject a Simple Event on an Event Inspector Service Dynamic Channel" and "How to Inject an Event as a JSON String on an Event Inspector Service Dynamic Channel" in the Oracle Fusion Middleware Visualizer User's Guide for Oracle Event Processing.

If you want to specify event injection configuration settings that are in place when the application is deployed or redeployed, configure injection by editing component configuration settings for the stage to which you want to inject.

For example, the component configuration excerpt shown in Section 22.3, "Event Injection Component Configuration Settings" illlustrates how you might configure a processor for event injection. The inject-parameters element's active child element specifies that injection is on, while the channel-name element specifies the HTTP pub-sub channel from which injected elements should be sent.

Example 22-6 Event Injection Component Configuration Settings

<processor>
    <name>FindCrossRates</name>
    <inject-parameters>
        <active>true</active>
        <channel-name>/NonClusteredServer/fx/FindCrossRates/output</channel-name>
    </inject-parameters>
    <rules>
        <!-- Query rules omitted. -->
    </rules>
</processor>

For reference information about these elements, see Section D.55, "inject-parameters".

For more information, see:

22.4 Tracing Events

After you configure the Event Inspector service HTTP pub-sub server, you can use Event Inspector clients to trace events flowing out of any stage of your EPN. To trace events, you can either use the Oracle Event Processing Visualizer to configure tracing or you can edit a component configuration file in your application to specify trace settings that are in place when the application is deployed or redeployed.

Configure event tracing in Oracle Event Processing Visualizer with settings that can be discarded when the application is redeployed. For more information on using Oracle Event Processing Visualizer to trace events, see "How to Trace Events on a Dynamic Channel" in the Oracle Fusion Middleware Visualizer User's Guide for Oracle Event Processing.

For event tracing configuration that is in place when the application is deployed or redeployed, configure tracing by editing component configuration settings for the stage from which you want to trace.

For example, the component configuration excerpt shown in Section 22.4, "Event Tracing Component Configuration Settings" illlustrates how you might configure a processor for event tracing. The trace-parameters element's active child element specifies that tracing is on, while the channel-name element specifies the HTTP pub-sub channel to which traced elements should be sent.

Example 22-7 Event Tracing Component Configuration Settings

<processor>
    <name>FindCrossRates</name>
    <trace-parameters>
        <active>true</active>
        <channel-name>/NonClusteredServer/fx/FindCrossRates/output</channel-name>
    </trace-parameters>
    <rules>
        <!-- Query rules omitted. -->
    </rules>
</processor>

For reference information about these elements, see Section D.106, "trace-parameters".

For more information, see: