wildfly / wildfly.org

Source code for WildFly Website (wildfly.org)
https://www.wildfly.org/
16 stars 91 forks source link

Wildfly mp messaging: Pause Consuming of messages #655

Open h2mch opened 3 weeks ago

h2mch commented 3 weeks ago

I'm using the smallrye-reactive-messaging (kafka) extension within wildfly

  /extension=org.wildfly.extension.microprofile.reactive-messaging-smallrye:add
  /extension=org.wildfly.extension.microprofile.reactive-streams-operators-smallrye:add

I can successfully consume messages within the application.

@ApplicationScoped
public class KafkaMessageConsumer {
//...
    @Incoming("consumerdata")
    public void consume(ConsumerRecord<String, String> message) {
        logger.debug("consume message with key {}", message.key());
        //...
    }
// ...
}

The application is running on multiple nodes. Is there a way to pause the consuming, so that only other nodes are consuming the messages without shutdown the application?

I tried something with:

    @Inject
    @Connector("smallrye-kafka")
    KafkaConnector kafkaConnector;
//...
                kafkaConsumer.pause().await().atMost(Duration.ofMillis(1_000));
// and
                kafkaConsumer.resume().await().atMost(Duration.ofMillis(1_000));

with the property pause-if-no-requests set to false. but this cause the full consuming group to pause.

bstansberry commented 5 days ago

Hi @h2mch,

I suggest you start a thread on the user forum at https://github.com/wildfly/wildfly.org/issues/655. We use this repo to track work on the wildfly.org website itself, so it's unlikely people who can answer your question will see it. (I can't answer it.)

Best regards, Brian