fix(manager-api-notifications): if error occurs in async subsystem, print to console
MODIFY
common/logging/jboss-logging/src/main/java/io/apiman/common/logging/jboss/JbossLoggerImpl.java
common/logging/jboss-logging/src/main/java/io/apiman/common/logging/jboss/JbossLoggerImpl.java
@@ -90,6 +90,6 @@ public class JbossLoggerImpl implements IApimanLogger {
@Override
public void error(Throwable error, String message, Object... args) {
- logger.errorv(message, message, args);
+ logger.errorv(error, message, args);
}
}

MODIFY
manager/api/rest-impl/src/main/java/io/apiman/manager/api/service/NotificationService.java
manager/api/rest-impl/src/main/java/io/apiman/manager/api/service/NotificationService.java
@@ -33,6 +33,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.concurrent.CompletionStage;
import java.util.stream.Collectors;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Event;
@@ -175,7 +176,13 @@ public class NotificationService implements DataAccessUtilMixin {
// 2. Emit notification onto notification bus.
LOGGER.trace("Firing notification: {0}", dto);
- notificationDispatcher.fireAsync(dto);
+ notificationDispatcher.fireAsync(dto)
+ .whenCompleteAsync((res, throwable) -> {
+ if (throwable != null) {
+ LOGGER.error(throwable, "An error occurred in the asynchronous part of the notification subsystem. "
+ + "This error likely did not return directly to the requester: {0}", throwable.getMessage());
+ }
+ });
});
}
}

fix(manager-api-notifications): if error occurs in async subsystem, print to console