Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fmachado091/5bd9b2e1cc25757c9087efeb78635161 to your computer and use it in GitHub Desktop.
Save fmachado091/5bd9b2e1cc25757c9087efeb78635161 to your computer and use it in GitHub Desktop.
@RestController
@RequestMapping("/hello")
public class HelloPubSubController {
private static final Logger LOGGER = LoggerFactory.getLogger(HelloPubSubController.class);
private final HelloPubSubPublisher publisher;
@Autowired
public HelloPubSubController(HelloPubSubPublisher publisher) {
this.publisher = publisher;
}
@PostMapping("/publish")
public void publish(@RequestBody String message) {
LOGGER.info("Received a POST at /hello/publish with message=[{}]", message);
publisher.publish(message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment