0

What is Trigger Event here ?

How to plug this to the EsperEngine for getting events ?

What URI should be passed ? how should engineURI look like ?

Is it the remote location of the esper engine ?

       ConfigurationHTTPAdapter adapterConfig = new ConfigurationHTTPAdapter();

        // add additional configuration
       Request request = new Request();
       request.setStream("TriggerEvent");
       request.setUri("http://localhost:8077/root");
       adapterConfig.getRequests().add(request);

       // start adapter
       EsperIOHTTPAdapter httpAdapter = new EsperIOHTTPAdapter(adapterConfig, "engineURI");
       httpAdapter.start();

       // destroy the adapter when done
       httpAdapter.destroy();

Changed the stream from TriggerEvents to HttpEvents and I get this exception given below

ConfigurationException: Event type by name 'HttpEvents' not found

Nagarjuna Pamu
  • 14,737
  • 3
  • 22
  • 40

2 Answers2

0

The "engineURI" is a name for the CEP engine instance and has nothing to do with the EsperIO http transport. Its a name for looking up what engines exists and finding the engine by name. So any text can be used here and the default CEP engine is named "default" when you allocate the default one.

You should define the event type of the event you expect to receive via http. A sample code is in http://svn.codehaus.org/esper/esper/trunk/esperio-socket/src/test/java/com/espertech/esperio/socket/TestSocketAdapterCSV.java

user650839
  • 2,594
  • 1
  • 13
  • 9
0

You need to declare your event type(s) in either Java, or through Esper's EPL statements. The reason why you are getting exception is because your type is not defined. Then you can start sending events by specifying type you are sending in HTTP request. For example, here is a bit of code in python:

import urllib
cepurl = "http://localhost:8084"

param =  urllib.urlencode({'stream':'DataEvent',
 'date':  datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
                'src':data["ipsrc"],
                'dst':data["ipdst"],
                'type':data["type"]})

# sending event:
f = urllib.urlopen(cepurl + "/sendevent?" + param);
rez = f.read()

in java this probably would be something like this:

SupportHTTPClient client = new SupportHTTPClient(); client.request(8084, "sendevent", "stream", "DataEvent", "date", "mydate");

fyg
  • 1
  • 1