esper.codehaus.org and espertech.comDocumentation
Input and output adapters to Esper provide the means of accepting events from various sources, and for making available events to destinations.
Most adapters present their own configuration as well as API. Some adapters also provide operators for use in data flows.
The following input and output adapters exist:
Table 1.1. Input and Output Adapters
Adapter | Description |
---|---|
File Input and Output Adapter |
The file input and output adapter can read and wirte files, transform the textual values into events, play the events into the engine and write events into a file. The adapter also makes it possible to run complete simulations of events arriving in time-order from different input streams. |
Spring JMS Input and Output Adapter |
JMS adapters based on the JmsTemplate offered by Spring 2. Provides unmarshalling of JMS |
Opentick Input Adapter |
The opentick input adapter receives real-time stock market data from opentick corporation's API. Please see |
The Adapter
interface allows client applications to control the state of an input and output adapter. It provides state transition methods that each
input and output adapter implements.
An input or output adapter is always in one of the following states:
Opened - The begin state; The adapter is not generating or accepting events in this state
Started - When the adapter is active, generating and accepting events
Paused - When operation of the adapter is suspended
Destroyed
The state transition table below outlines adapter states and, for each state, the valid state transitions:
Table 1.2. Adapter State Transitions
Start State | Method | Next State |
---|---|---|
Opened | start() | Started |
Opened | destroy() | Destroyed |
Started | stop() | Opened |
Started | pause() | Paused |
Started | destroy() | Destroyed |
Paused | resume() | Started |
Paused | stop() | Opened |
Paused | destroy() | Destroyed |
The com.espertech.esperio.AdapterInputSource
encapsulates information about an input source. Input adapters use the AdapterInputSource
to determine how to read input. The class provides constructors for use with different input sources:
java.io.Reader
to read character streams
java.io.InputStream
to read byte streams
java.net.URL
Classpath resource by name
java.io.File
Adapters resolve Classpath resources in the following order:
Current thread classloader via Thread.currentThread().getContextClassLoader().getResourceAsStream
If the resource is not found: AdapterInputSource.class.getResourceAsStream
If the resource is not found: AdapterInputSource.class.getClassLoader().getResourceAsStream