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 8701989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:32:18+00:00 2026-06-13T02:32:18+00:00

in JSP when i reach QueueingConsumer.Delivery delivery = consumer.nextDelivery() the page gets stuck loading.

  • 0

in JSP when i reach “QueueingConsumer.Delivery delivery = consumer.nextDelivery()” the page gets stuck loading. the message is consumed but the jsp won’t load nor does it give errors. please help

String QUEUE_NAME = "hello";

ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();

channel.queueDeclare(QUEUE_NAME, false, false, false, null);
out.println(" [*] Waiting for messages. To exit press CTRL+C");

QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(QUEUE_NAME, true, consumer);

while (true) {
  QueueingConsumer.Delivery delivery = consumer.nextDelivery();
  String message = new String(delivery.getBody());
  out.println(" [x] Received '" + message + "'");
}
  • 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-13T02:32:20+00:00Added an answer on June 13, 2026 at 2:32 am

    I am guessing that you are trying to implement the RabbitMQ “Hello World” tutorial in a JSP page.
    You can’t do this as:

    • QueueingConsumer.nextDelivery will block until a message is available on the queue
    • To show all messages as they arrive at the head of the queue you need an infinite loop (as shown in the tutorial) which won’t work in a JSP page.

    Your JSP page is part of the request lifecycle, which needs to end as soon as possible and return the requested resource (in this case the HTML etc in your JSP page) to the user’s browser. Although most browsers will start displaying results as they receive them they won’t deal with a long hiatus or a never-ending response. Even if they could you don’t want this as there will be a limit to the number of concurrent requests your server can handle.

    If you are playing around with RabbitMQ to see how it works then I would recommend you develop a Java application (as per the tutorial), i.e. don’t try to do it in a webapp. (Also, as pointed out by fvu, note that QueueingConsumer is now deprecated).

    If you need to do it in a webapp then you’ll need to think of a way to store messages (e.g. in a database or a singleton data structure if you have a single instance of e.g. Tomcat) as they are taken off the message queue (probably by a background thread, i.e. not one that services requests). Your JSP page can then read the messages from your data structure to display to the user.

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

Sidebar

Related Questions

In JSP page we can access to attributes using this: ${name} . But if
My jsp page <select name=se> <option value=1>D1</option> <option value=2>D2</option> <option value=3>D3</option> </select> While the
In JSP, I notice that I can't render ${} into HTML. After the page
Below am posting my jsp page. home.jsp <%@taglib uri=/WEB-INF/struts-bean.tld prefix=bean%> <%@taglib uri=/WEB-INF/struts-html.tld prefix=html %>
On my JSP page, I defined some javascript with a variable that get value
In my JSP page, a tag <jsp:include page=servletName /> has been added. Here servletName
I have a JSP page where there is a row of buttons in their
The jsp page named uploadTextContent.jsp contains the following code, <html:cancel value=Close accesskey=c styleClass=Button onclick=JavaScript:closeWellFormatContent('<%=request.getAttribute(message)%>')
I'm writing an application in JSP that needs to reach out to a remote
In jsp page directives we mentioned contentType=MIME-Type, in this MIME means what?

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.