2015-12-18

MBassador PublicationErrorHandler

Errors, where are you?

I was very confused when my thrown events didn't show any results somewhere. And then, I realized I did not pay enough attention, because MBassador was indeed very nice to suggest registering an ErrorHandler for publication failures. The documentaiton is quite sparse about that, it took me some time to figure it out, so with version around 1.2.4, this is the way you can do it:

 IBusConfiguration config = new BusConfiguration()
  .addFeature(Feature.SyncPubSub.Default())
  .addFeature(Feature.AsynchronousHandlerInvocation.Default())
  .addFeature(Feature.AsynchronousMessageDispatch.Default())
  .addPublicationErrorHandler(error -> {
    System.out.println(error);
  });
 new MBassador(config);