When implementing your Task Types and Function in Java, you can implement them as POJOs or as EJBs: it is recommended to use POJOs unless the object needs to use a server service.
In such a case, the EJB must be then registered with the Execution Engine using the ComponentServiceBean
.
If your custom object needs to inject EJBs, you will need to implement its as EJB and register it with the Execution Engine:
registerCustomComponents()
method:@Override protected void registerCustomComponents() { //register(<task_instance>, <task_interface>.class); register(sendGoodsTask, SendGoodsTask.class); //register(<function_instance>, <function_interface_class>.class); register(shippingFeeFunctions, ShippingFeeFunctions.class); }
@Override protected void registerCustomComponents() { register(<task_instance>, <task_implementation>.class); register(<function_instance>, <function_implementation>.class); }
If a custom a task or function implemented as a session bean fails with an exception on runtime, the current transaction is rolled back and the interpretation fails even if the exception is caught later (for example, by a boundary Error Intermediate Event). Hence make sure to catch all exceptions in your bean.
Use RuntimeExceptionCatcherInterceptor
as an interceptor in your stateless beans. This interceptor catches all runtime exceptions thrown from a bean's business methods and converts them to ErrorExceptions, which can be handled in your model by the with the error mechanism of the GO-BPMN Modeling Language.