Last active
December 19, 2018 01:52
-
-
Save fmachado091/2f5a29b897709aab15622e72469fef54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class PubSubConsumer { | |
/** | |
* Name of an existing Pub/Sub subscription. | |
*/ | |
public abstract String subscription(); | |
/** | |
* The actual consumer logic. | |
* | |
* @param message Wrapper of a Pub/Sub message that adds acknowledging capability. | |
*/ | |
protected abstract void consume(BasicAcknowledgeablePubsubMessage message); | |
/** | |
* Implementation of a {@link Consumer} functional interface which only calls the | |
* {@link #consume(BasicAcknowledgeablePubsubMessage) consume} method. | |
*/ | |
public Consumer<BasicAcknowledgeablePubsubMessage> consumer() { | |
return basicAcknowledgeablePubsubMessage -> consume(basicAcknowledgeablePubsubMessage); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment