com.rollbar.reactivestreams.notifier.ReactorRollbar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rollbar-reactive-streams-reactor Show documentation
Show all versions of rollbar-reactive-streams-reactor Show documentation
For connecting your applications built on the JVM to Rollbar for Error Reporting
package com.rollbar.reactivestreams.notifier;
import com.rollbar.reactivestreams.notifier.config.Config;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
*
* Async, non-blocking Rollbar notifier with additional helper methods to handle {@link Mono} and
* {@link Flux} errors.
*
*/
public class ReactorRollbar extends Rollbar {
public ReactorRollbar(Config config) {
super(config);
}
/**
* Logs the error to Rollbar and returns the original {@link Mono}.
*
* @param t The error that occurred
* @param The type of elements of the Mono
* @param The type of the error
* @return The original success or failure {@link Mono}, after logging the error to Rollbar
*/
public Mono extends T> logMonoError(E t) {
return Mono.from(error(t)).flatMap(ignored -> Mono.error(t));
}
/**
* Logs the error to Rollbar and returns the original {@link Flux}.
*
* @param t The error that occurred
* @param The type of elements of the Flux
* @param The type of the error
* @return The original success or failure {@link Flux}, after logging the error to Rollbar
*/
public Flux extends T> logFluxError(E t) {
return Flux.from(error(t)).flatMap(ignored -> Flux.error(t));
}
}