gs-messaging-gcp-pubsub icon indicating copy to clipboard operation
gs-messaging-gcp-pubsub copied to clipboard

MessageReceiver - Cannot Receive a batch of messages.

Open vijaysdey88 opened this issue 4 years ago • 0 comments

For using the spring-cloud-gcp-starter-pubsub to consume messages via Pull using PubSubInboundChannelAdapter. Our use case needs to process a batch of messages on the Message Receive handler.

We try consuming a batch of messages by wiring in below Message Handler. However, only one message is delivered at a time. Please note, a similar wired MessageReciever works for Kafka stream binder so we wanted to harness similar construct. Could you please help us with this need?

@ServiceActivator(inputChannel = "pubsubInputChannel")
    public void messageReceiver(List<Message> messages) {
        LOGGER.info("Message arrived! Payload Count: " + messages.stream().count()); // Always prints 1
        processBatch(messages)
    }

vijaysdey88 avatar May 04 '21 16:05 vijaysdey88