We ended up with an exception thrown in the forEach of our stream, which is
a stream to manage notifications and that should be always on. Nothing got
reported, but the stream stopped working. Finally testing isConnected
reported false and then found the source of the exception.

Now digging, we found out that there are onError and onClose, but couldn't
find any example. First time tried to insert after the createStream but
debugging found that this seemed to be tied to the filter intermediate
stream. Now moving the onClose, is working but very unsure if the pattern
is correct.

private void handleEvents() {
   psp.createStream(spes) //NOSONAR as we don't close it
      .filter(isOfInterest())
      .onError(e -> {
          log.error(Messages.CNCI_0, e);
          handleEvents(); // start a new stream
      })
      .forEach(entry -> entry.listener.notify(entry.notification)
   );
 }

Thanks
Alain
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to