Is it possible to retrieve a connector's exception message and stack trace with a CONNECTOR_INSTANCE_STATE_UPDATED Event Handler?



Consider a task or activity with:

  • a connector that throws an error event when it fails
  • a boundary catch error event that catches the error thrown by the connector

Now, when the connector fails, the boundary event will catch the error, and the task/activity will be archived, as a result of which the failed connector's exception message and stack trace will be lost from the portal (sure enough, they will have been logged in the server log file, but that is only accessible to the system administrator).


  • Would it be somehow possible to use an Event Handler triggered by the CONNECTOR_INSTANCE_STATE_UPDATED event (or even the more general CONNECTOR_INSTANCE_UPDATED one) to catch the exception message and stack trace from the newly failed connector (before the connector is archived alongside the task/activity by the boundary event) and make it available to the portal user or administrator?
  • How could the ConnectorInstanceWithFailureInfoImpl class be used, to benefit from the getExceptionMessage() and getStackTrace() methods?

Thanks in advance for your help,


1 answer

This one is the BEST answer!


This method is called when setting the connector as failed:

This produces an update event of type CONNECTOR_INSTANCE_UPDATED with fields updated: exceptionMessage and stackTrace

The handle should be registered on the CONNECTOR_INSTANCE_UPDATED event type.

The is isInterested method should check the type of the and fields of the event like that:

    public boolean isInterested(SEvent event) {  
        return event instanceof SUpdateEvent  
                && event.getObject() instanceof SConnectorInstanceWithFailureInfo  
                && Optional.ofNullable(((SUpdateEvent) event).getUpdatedFields())  
                        .filter(map -> map.containsKey("exceptionMessage"))  
                        .filter(map -> map.containsKey("stackTrace"))  

and then you can safely cast the event or the object in the execute method

    public void execute(SEvent event) throws SHandlerExecutionException {  
        SConnectorInstanceWithFailureInfo connector = (SConnectorInstanceWithFailureInfo) event.getObject();  
        String exceptionMessage = ((SUpdateEvent) event).getUpdatedFields().get("exceptionMessage");  
        String stackTrace = ((SUpdateEvent) event).getUpdatedFields().get("stackTrace");  




Submitted by unai.gaston.caminos on Thu, 11/19/2020 - 13:01

Thanks a lot, Baptiste, much appreciated!