Created
January 24, 2021 13:57
-
-
Save danielkec/8a9866aee25096d054cdc7b5bfa1fbd4 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
final SubmissionPublisher<CloudEvent> emitter = new SubmissionPublisher<>(); | |
@Outgoing("to-stream") | |
public PublisherBuilder<CloudEvent> registerEmitter() { | |
return ReactiveStreams.fromPublisher(FlowAdapters.toPublisher(emitter)); | |
} | |
@POST | |
@Path("/send/{msg}") | |
public void send(@PathParam("msg") String payload) { | |
CloudEvent cloudEvent = eventTemplate | |
.withId(UUID.randomUUID().toString()) | |
.withData(MediaType.TEXT_PLAIN, payload.getBytes()) | |
.build(); | |
emitter.submit(cloudEvent); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment