« Return to Thread: using route outside Subscriber to insert into named window

using route outside Subscriber to insert into named window

by Andy Flury-2 :: Rate this Message:

| View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.
using route outside Subscriber to insert into named window

Hi

According to the doc you are supposed to use the route method inside Subscribers / Listeners to send events back into the engine. Unfortunately several use cases in our application are sometime called from within a Subscribers and sometimes called from outside a Subscriber.

I looks like events sent into the engine by means of the route, called from outside a Subscriber, will never arrive in the Named Window. See test case below:

Configuration config = new Configuration();

config.addEventType("TestEvent", TestEvent.class);

EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config);

EPStatement statement = epService.getEPAdministrator().createEPL(

        "create window TestWindow.std:lastevent() as (id int)");

epService.getEPAdministrator().createEPL(

        "insert into TestWindow select id from TestEvent");

epService.getEPRuntime().sendEvent(new TestEvent(1));

Iterator<EventBean> it = statement.iterator();

while (it.hasNext()) {

        System.out.println(it.next().getUnderlying());

}

epService.destroy();

When changing sendEvent to route, the event will not arrive in the named window!

Is there a way to query the engine whether it is currently in the process of evaluating events and in that case use the route method (and otherwise use the sendEvent method)?

Any help is appreciated

andy

 « Return to Thread: using route outside Subscriber to insert into named window