You can use the event record and playback feature to debug a running Oracle Stream Explorer application. While the application runs, you record the events that flow out of an EPN component into a persistent store. You play the events back at a later stage in the application such as in an event bean. In the event bean, you query the events and make fixes to your application based on your findings.
The sample code in this chapter is from the event record and playback example in /Oracle/Middleware/my_oep/
examples/source/applications/recplay
. For details about running and building the example, see Getting Started with Event Processing for Oracle Stream Explorer.
This chapter includes the following sections:
The following graphic shows the EPN of the event record and playback example to demonstrate where you can record events and where you can play events back. The simpleEventSource
adapter is configured to record events. The recording happens as events flow out of the adapter. The eventStream
channel is configured to play back events. The playback happens where events flow into the channel.
Figure 15-1 Configuring Record and Playback in an EPN
When you record events, by default the Oracle Stream Explorer server stores them in Berkeley DB, which is a persistent event store that is bundled with the Oracle Stream Explorer server. Berkeley DB is a fast, scalable, transactional database with industrial grade reliability and availability. For more information about Berkeley DB, see:
http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html
.
When you deploy an application that is configured to use the record and playback feature, the Oracle Stream Explorer server creates the database schema and an instance of Berkeley DB in the following directory.
/Oracle/Middleware/my_oep//user_projects/domains/domainname/servername/bdb
Note:
The database key is the record time plus the sequence number.
You can use the default Berkeley database configuration as is. You only need to make configuration changes to customize the location of the Berkeley database instance or to tune performance. See Configure Berkeley DB for information about how to configure Berkeley DB.
You can use the event store API to query a store for past events given a record time range and the component from which the events were recorded. The actual query you use depends on the event repository provider; for example, you would use Oracle CQL for the default persistent event store provider included with Oracle Stream Explorer. You can also use these APIs to delete old events from the event store.
You can configure recording for any component in the EPN that produces events, such as processors, adapters, channels, and event beans. Processors and channels always produce events. Adapters and event beans must implement the EventSource
interface.
You can configure events from different components in the EPN to be stored in different persistent stores, or that all events go to the same store. Only events that are output by the component are recorded.
You enable the recording of events for a component by updating its configuration file and adding the record-parameters
element. Using the child elements of record-parameters
, you specify the event store to which the events are recorded, an initial time period when recording should take place, the list of event types you want to store, and so on.
After you deploy the application and events start flowing through the network, recording begins either automatically because you configured it to start at a certain time or because you dynamically start it using administration tools. For each component you have configured for recording, Oracle Stream Explorer stores the events that flow out of it to the appropriate store along with a time stamp of the time it was recorded.
You can configure playback for any component in the EPN: processors, adapters, streams, and event beans. Typically the playback component is a stage later in the network than the stage that recorded the events.
You enable the playback of events for a component by updating its configuration file and adding the playback-parameters
element. Using the child elements of playback-parameters
, you specify the event store from which the events are played back, the list of event types you want to play back (by default all are played back), the time range of the recorded events you want to play back, and so on. By default, Oracle Stream Explorer plays back the events in a time accurate manner. However, you can configure that the events get played back either faster or slower than they originally flowed out of the component from which they were recorded.
After you deploy the application and events start flowing through the network, you must start the playback with Oracle Stream Explorer Visualizer or wlevs.Admin
. Oracle Stream Explorer reads the events from the persistent store and inserts them into the appropriate place in the EPN.
When a component receives a playback event, the playback event looks exactly like the original event. If a downstream component is configured to record events, then Oracle Stream Explorer records the arriving playback events and real-time events.
For more information, see:
You can use the default Berkeley DB configuration as is. You only need to make configuration changes to customize the location of the Berkeley database instance or to set the cache size to tune performance.
To configure an event store for Oracle Stream Explorer server:
You can configure any processor, adapter, channel, or event bean in your application to record events. This section updates an adapter configuration to record events. See Schema Reference for Oracle Stream Explorer for the complete XSD Schema that describes the event recording configuration file elements.
Table 15-2 lists the child elements of record-parameters
that you can specify. Only dataset-name
is required.
Table 15-2 Child Elements of record-parameters
|
You can configure any processor, adapter, channel, or event bean in your application to play back events. The component must downstream from the recording component so that the playback component can receive the events and play them back. This section updates a channel configuration to play back events.
See Schema Reference for Oracle Stream Explorer for the complete XSD Schema that describes the event playback configuration file elements.
Table 15-3 lists the child elements of playback-parameters
that you can specify. Only dataset-name
is required.
Table 15-3 Child Elements of playback-parameters
|
After you configure the record and playback functionality for the components of an application, and you deploy the application to Oracle Stream Explorer, the server starts to record events only when you have configured explicit star and stop information in the configuration file. For example, if you included the following element in a component configuration, then recording starts on January 20, 2010 at 5:00 am:
<time-range> <start>2010-01-20T05:00:00</start> <end>2010-01-20T18:00:00</end> </time-range>
To enable the recording and playback of events, use Oracle Stream Explorer Visualizer or wlevs.Admin
. Once recording and playback are enabled, they start and stop according to their configuration settings.
For more information, see:
Visualizer and wlevs.Admin
use managed beans (MBeans) to dynamically start and stop event recording and playback and manage the event store configuration. A managed bean is a Java bean that provides a Java Management Extensions (JMX) interface. JMX is the Java EE solution for monitoring and managing resources on a network. You can create your own administration tool and use JMX to manage event store functionality with com.bea.wlevs.management.configuration.StageMBean
.
For more information, see: