All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.tech.hermes.consumers.consumer.sender.googlepubsub.GooglePubSubMessageSentCallback Maven / Gradle / Ivy

There is a newer version: 2.10.0
Show newest version
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