Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2950

Exceptions thrown from onEvent processing should trigger an error to SSE consumers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • None
    • jaxrs
    • None
    • Undefined

    Description

      Currently if an exception occurs during SSE event processing that is passed back to org.jboss.resteasy.plugins.providers.sse.client.SseEventSourceImpl.onEvent(), the exception is lost, onEvent processing is halted, and no exceptions or error events are triggered. 

      I propose the onEvent() method should be changed to catch these exceptions and call the onUnrecoverableError(Throwable) method passing the exception.

      private void onEvent(final InboundSseEvent event)
       {
           if (event.getId() != null)
           {
               lastEventId = event.getId();
           }
           if (event.isReconnectDelaySet())
           {
               reconnectDelay = event.getReconnectDelay();
           }
           try {
               onEventConsumers.forEach(consumer -> {
                   consumer.accept(event);
               });
           } catch (Throwable t) {
               // Something when wrong in event processing so post error to consumers.
               onUnrecoverableError(t);
           }
       }
      

      Attachments

        Activity

          People

            rchakrab Ranabir Chakraborty
            jim_krueger Jim Krueger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: