2

I am currently using Esper within a Storm topology and I am aware that there is a method callback called update() that is called when Esper produces a result.

I have been wondering what would happen if there is an error within the Esper engine itself.

Is there an error callback that I can override and catch the Exception?

Or is my best bet to simply wrap the sendEvent() call in a try-catch and then deal with the Exception accordingly?

akash
  • 22,664
  • 11
  • 59
  • 87
mchinaloy
  • 1,444
  • 3
  • 25
  • 42

2 Answers2

1

After further reading I can see that Esper has the notion of Exception Handling:

http://esper.codehaus.org/esper-4.2.0/doc/reference/en/html/configuration.html#config-engine-exceptionhandling

This should satisfy my use case and catch any internal Esper exceptions.

mchinaloy
  • 1,444
  • 3
  • 25
  • 42
1

Yes, Esper provides a way for Exception Handling.

You may register one or more exception handlers for the engine to invoke in the case it encounters an exception processing a continuously-executing statement

You can register ExceptionHandlerFactory like below.

Configuration config = new Configuration();
config.getEngineDefaults().getExceptionHandling().addClass(MyCEPEngineExceptionHandlerFactory.class);

You should give the full-qualified class name of each class that implements the com.espertech.esper.client.hook.ExceptionHandlerFactory interface in the engine defaults configuration.

For more details, please read the documentation. .

Nishu Tayal
  • 20,106
  • 8
  • 49
  • 101