简体   繁体   中英

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();
        }
    }

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM