Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fmachado091/2f5a29b897709aab15622e72469fef54 to your computer and use it in GitHub Desktop.
Save fmachado091/2f5a29b897709aab15622e72469fef54 to your computer and use it in GitHub Desktop.
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