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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:55:49+00:00 2026-05-26T11:55:49+00:00

Durable and persistent mode appear to relate to reboots rather than relating to there

  • 0

“Durable” and “persistent mode” appear to relate to reboots rather than relating to there being no subscribers to receive the message.

I’d like RabbitMQ to keep messages on the queue when there are no subscribers. When a subscriber does come online, the message should be recieved by that subscriber. Is this possible with RabbitMQ?

Code sample:

Server:

namespace RabbitEg
{
    class Program
    {
        private const string EXCHANGE_NAME = "helloworld";

        static void Main(string[] args)
        {
            ConnectionFactory cnFactory = new RabbitMQ.Client.ConnectionFactory() { HostName = "localhost" };

            using (IConnection cn = cnFactory.CreateConnection())
            {
                using (IModel channel = cn.CreateModel())
                {
                    //channel.ExchangeDelete(EXCHANGE_NAME);
                    channel.ExchangeDeclare(EXCHANGE_NAME, "direct", true);
                    //channel.BasicReturn += new BasicReturnEventHandler(channel_BasicReturn);

                    for (int i = 0; i < 100; i++)
                    {
                        byte[] payLoad = Encoding.ASCII.GetBytes("hello world _ " + i);
                        IBasicProperties channelProps = channel.CreateBasicProperties();
                        channelProps.SetPersistent(true);

                        channel.BasicPublish(EXCHANGE_NAME, "routekey_helloworld", false, false, channelProps, payLoad);

                        Console.WriteLine("Sent Message " + i);
                        System.Threading.Thread.Sleep(25);
                    }

                    Console.ReadLine();
                }
            }
        }
    }
}

Client:

namespace RabbitListener
{
    class Program
    {
        private const string EXCHANGE_NAME = "helloworld";

        static void Main(string[] args)
        {
            ConnectionFactory cnFactory = new ConnectionFactory() { HostName = "localhost" };

            using (IConnection cn = cnFactory.CreateConnection())
            {
                using (IModel channel = cn.CreateModel())
                {
                    channel.ExchangeDeclare(EXCHANGE_NAME, "direct", true);

                    string queueName = channel.QueueDeclare("myQueue", true, false, false, null);
                    channel.QueueBind(queueName, EXCHANGE_NAME, "routekey_helloworld");

                    Console.WriteLine("Waiting for messages");

                    QueueingBasicConsumer consumer = new QueueingBasicConsumer(channel);
                    channel.BasicConsume(queueName, true, consumer);

                    while (true)
                    {
                        BasicDeliverEventArgs e = (BasicDeliverEventArgs)consumer.Queue.Dequeue();
                        Console.WriteLine(Encoding.ASCII.GetString(e.Body));
                    }
                }
            }
        }
    }
}
  • 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-05-26T11:55:49+00:00Added an answer on May 26, 2026 at 11:55 am

    See the AMQP Reference for an explanation of what durable and persistent mean.

    Basically, queues are either durable or non-durable. The former survive broker restarts, the latter do not.

    Messages are published as either transient or persistent. The idea is that persistent messages on durable queues should also survive broker restarts.

    So, to get what you want, you need to 1) declare the queue as durable and 2) publish the messages as persistent. In addition, you may also want to enable publisher confirms on the channel; that way, you’ll know when the broker has assumed responsibility for the message.

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

Sidebar

Related Questions

my Message Driven Bean executes highly intensive operations so I would like to restrict
We have a hub-and-spoke network topology with activemq with topic and durable subscribers. After
Is there any durable way to detect that is file located somewhere on external
If you want to use a queuing product for durable messaging under Windows, running
I want to use java.util.ConcurrentLinkedQueue as a non-durable queue for a Servlet. Here's the
The situation: a workflow hosted in ASP.NET application using WorkflowServiceHost and contains durable delay
If I use durable subscription, can I restart my client and resubscribe without loosing
I have a WF service that I'm trying to setup receive activities to Subscribe
I'm using phonegap build to publish apps, and it looks like localstorage is getting
Is there library usable from c++ for sharing fairly simple data (integers,floating point numbers,

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.