Created
December 29, 2018 12:41
-
-
Save fmachado091/a429b65a2e70ea2d8744c0e727d86254 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 PubSubPublisher { | |
private static final Logger LOGGER = LoggerFactory.getLogger(PubSubPublisher.class); | |
private final PubSubTemplate pubSubTemplate; | |
protected PubSubPublisher(PubSubTemplate pubSubTemplate) { | |
this.pubSubTemplate = pubSubTemplate; | |
} | |
protected abstract String topic(); | |
public void publish(String message) { | |
LOGGER.info("Publishing to topic [{}]. Message: [{}]", topic(), message); | |
pubSubTemplate.publish(topic(), message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment