Using esper
or nesper
I can issue events either from the runtime directly like so:
EPRuntime runtime = provider.getEPRuntime();
MyCustomEvent e = new MyCustomEvent("foo");
runtime.sendEvent(order);
or I can use a custom event sender like so:
EventSender sender = epService.EPRuntime.GetEventSender("MyCustomEvent");
MyCustomEvent e = new MyCustomEvent("foo");
sender.SendEvent(e);
I've tried to time this and it looks like the custom event sender might be faster, though it doesn't really seem to make a big performance difference from what I've seen.
Is there a compelling reason to chose one method over the other?
If I go with the second method of a custom EventSender
, is it safe to cache the EventSender
I get from the runtime so I don't have to query for it each time?