Skip to content

Process batch messages concurrently in one consumer #923

@jalr4ever

Description

@jalr4ever

Hi, this's an SDK-using question. I am now using com.rabbitmq:amqp-client:5.14.2 in my project.

Which consume messages like this:

    public void listenAndCalculate() {
        Channel channel = getChannel();
        try {
            channel.basicConsume(PARAM_QUEUE, false, new DefaultConsumer(channel) {
                @Override
                public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) {
                    // do something...
                 }
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }
    }

I found that the message would be only processed serially but not concurrently. I can find nothing to do but in spring, well in Spring-AMQP it provided a way like new SimpleRabbitListenerContainerFactory().setConcurrentConsumers(30);

But the problem is I don't want to use Spring things in my project, is there a way to process batch messages concurrently in one consumer?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions