I have an incoming io.cloudevents.CloudEvent object from HTTP POST, and would like to relay the object as-is to the Kafka topic using Quarkus using this approach. Is there a way to do this? Thanks.
----RESTResource.java-----
@Inject
@Broadcast
@Channel("mychannel") Emitter<CloudEvent> ceEmitter;
@POST
public CompletionStage<Response> sendEvent(CloudEvent object) {
return CompletableFuture.supplyAsync(() -> {
Set<ConstraintViolation<CloudEvent>> violations = validator.validate(object);
ceEmitter.send(object);
return Response.accepted().build();
});
}
-----KafkaProducer.java-----
@Incoming("mychannel")
@Outgoing("mytopic")
public Message<CloudEvent> generate(CloudEvent ce) {
return Message.of(ce);
}
mp.messaging.outgoing.mytopic.value.serializer=??? mp.messaging.incoming.mytopic.value.deserializer=???