animusdx
animusdx

Reputation: 410

Quarkus pulling from Kafka Topic and Sending JSON Payload to a REST endpoint

So, I'm using Quarkus along with the Microprofile Reactive Messaging framework (with the SmallRye Kafka connectors), and the RxJava2 Flowable streams object for reactive message receiving/sending. I have a microservice that uses the @Incoming and @Outgoing annotations to properly use channels to pull from back topics and push messages to topics.

However, now I want to modify this so I can still pull from a Kafka topic and now send a JSON payload to a REST endpoint. As far as I'm aware there is no Quarkus HTTP compatible SmallRye connector. Does anyone happen to know of any methods to get this to work?

Example function

    @Incoming("pre-check")
    @Outgoing("post-check")
    @Broadcast
    public Flowable<CustomMessage> publishToApi(CustomMessage customMessage) {

        LOGGER.info("Message received from topic = {}", customMessage);

        if (customMessage.ready) {
            return Flowable.just(customMessage);
        }
        else {
            return Flowable.empty();
        }
    }

Upvotes: 1

Views: 800

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191743

Remove @Outgoing and use any HTTP client to process the message to send it to some server

Or make the outgoing channel the response of your client

Upvotes: 1

Related Questions