pl.allegro.tech.hermes.consumers.consumer.sender.googlepubsub.GooglePubSubMessageSentCallback Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-consumers Show documentation
Show all versions of hermes-consumers Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.consumers.consumer.sender.googlepubsub;
import com.google.api.core.ApiFutureCallback;
import pl.allegro.tech.hermes.consumers.consumer.sender.MessageSendingResult;
import java.util.concurrent.CompletableFuture;
import static pl.allegro.tech.hermes.consumers.consumer.sender.MessageSendingResult.failedResult;
import static pl.allegro.tech.hermes.consumers.consumer.sender.MessageSendingResult.succeededResult;
class GooglePubSubMessageSentCallback implements ApiFutureCallback {
private final CompletableFuture resultFuture;
GooglePubSubMessageSentCallback(CompletableFuture resultFuture) {
this.resultFuture = resultFuture;
}
@Override
public void onFailure(Throwable throwable) {
resultFuture.complete(failedResult(throwable));
}
@Override
public void onSuccess(String messageId) {
resultFuture.complete(succeededResult());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy