Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8289457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:30:45+00:00 2026-06-08T12:30:45+00:00

I’m trying to run a pretty basic application utilizing RabbitMQ in Java. I’d simple

  • 0

I’m trying to run a pretty basic application utilizing RabbitMQ in Java. I’d simple like to consume messages concurrently using a Java ExecutorService. My project is using Spring, so I’ve defined my ThreadPoolExecutorFactoryBean like so:

<bean class="org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean"
        destroy-method="destroy">
    <property name="corePoolSize" value="8"/>   
    <property name="keepAliveSeconds" value="600"/>
    <property name="maxPoolSize" value="16"/>
    <property name="threadGroupName" value="CallbackQueue-Group"/>
    <property name="threadNamePrefix" value="CallbackQueue-Worker-"/>
</bean>

I’m injecting this bean into my main mesasge queue utilizing class which is doing something like this:

this.connection = getConnectionFactory().newConnection(getQueueExecutor());
this.channel = this.connection.createChannel();
this.channel.queueDeclare(getQueueName(), true, false, false, null);
this.channel.basicConsume(getQueueName(), false, new DefaultConsumer(this.channel) {
    @Override public void handleDelivery(String consumerTag, Envelope envelope, 
            BasicProperties properties, byte[] body) throws IOException {
        logger.debug("Received message {}", properties.getCorrelationId());

        try { Thread.sleep(3000); } catch (InterruptedException e) {};

        getChannel().basicAck(envelope.getDeliveryTag(), false);
    }
});

Simply put, when I post multiple messages to the queue, I should see the log statements happen fairly close together, even though the tasks take a while to execute. However, I’m seeing that my consumer is only processing one task at a time, in spite of the ExecutorService! What’s even weirder is that I’m actually seeing different threads in the pool service the queue, albeit never at the same time:

12:43:40.650 [CallbackQueue-Worker-2] DEBUG MyApplication - Received message 65bfbba29b4965eb0674c082c73dad7c
12:43:43.737 [CallbackQueue-Worker-3] DEBUG MyApplication - Received message 2a0b29012b13857c5a0ae8060f66dbaa
12:43:46.755 [CallbackQueue-Worker-3] DEBUG MyApplication - Received message 3c0742f9a284ac9c6b602200254c70db
12:43:49.769 [CallbackQueue-Worker-3] DEBUG MyApplication - Received message a462236fab19d51ba4bfea1582410a64
12:43:52.783 [CallbackQueue-Worker-3] DEBUG MyApplication - Received message 1a4713e1066dfc9e4ec1302098450a1f

What am I doing wrong here? Is there some additional configuration which I missed in either my ThreadPoolExecutorFactoryBean or in my RabbitMQ code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:30:47+00:00Added an answer on June 8, 2026 at 12:30 pm

    From description of com.rabbitmq.client.Channel:

    While a Channel can be used by multiple threads, it’s important to
    ensure that only one thread executes a command at once. Concurrent
    execution of commands will likely cause an UnexpectedFrameError to be
    thrown.

    Could this be a reason? Your log shows that different workers are used (we see 2 and 3), but only one worker a time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.