RabbitMQ and IoT device: keep queue open?









up vote
0
down vote

favorite












We're using RabbitMQ in a new project. We'll have IoT devices communicating with queues.



For the devices to send info to the cloud we don't see any issues, however sometimes we need to deliver messages from our backend to the IoT devices. For this we let the devices open an exclusive queue. This works perfectly, as long as the devices are online. When they aren't, the queue is closed and no messages can be send to it anymore.



Is there a way to keep the queue open, so messages are kept until the IoT device comes back online?



Vice-versa: Is there some way to have guaranteed delivery starting at the IoT device. For example: energy measurements every 15 minutes. If the connection drops, messages should be stored on disk (to prevent message loss in case of power cut). They are sent later on when the connection comes back online. Does a service or client library exist that implements this or do we need to develop this ourselves?










share|improve this question

























    up vote
    0
    down vote

    favorite












    We're using RabbitMQ in a new project. We'll have IoT devices communicating with queues.



    For the devices to send info to the cloud we don't see any issues, however sometimes we need to deliver messages from our backend to the IoT devices. For this we let the devices open an exclusive queue. This works perfectly, as long as the devices are online. When they aren't, the queue is closed and no messages can be send to it anymore.



    Is there a way to keep the queue open, so messages are kept until the IoT device comes back online?



    Vice-versa: Is there some way to have guaranteed delivery starting at the IoT device. For example: energy measurements every 15 minutes. If the connection drops, messages should be stored on disk (to prevent message loss in case of power cut). They are sent later on when the connection comes back online. Does a service or client library exist that implements this or do we need to develop this ourselves?










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      We're using RabbitMQ in a new project. We'll have IoT devices communicating with queues.



      For the devices to send info to the cloud we don't see any issues, however sometimes we need to deliver messages from our backend to the IoT devices. For this we let the devices open an exclusive queue. This works perfectly, as long as the devices are online. When they aren't, the queue is closed and no messages can be send to it anymore.



      Is there a way to keep the queue open, so messages are kept until the IoT device comes back online?



      Vice-versa: Is there some way to have guaranteed delivery starting at the IoT device. For example: energy measurements every 15 minutes. If the connection drops, messages should be stored on disk (to prevent message loss in case of power cut). They are sent later on when the connection comes back online. Does a service or client library exist that implements this or do we need to develop this ourselves?










      share|improve this question













      We're using RabbitMQ in a new project. We'll have IoT devices communicating with queues.



      For the devices to send info to the cloud we don't see any issues, however sometimes we need to deliver messages from our backend to the IoT devices. For this we let the devices open an exclusive queue. This works perfectly, as long as the devices are online. When they aren't, the queue is closed and no messages can be send to it anymore.



      Is there a way to keep the queue open, so messages are kept until the IoT device comes back online?



      Vice-versa: Is there some way to have guaranteed delivery starting at the IoT device. For example: energy measurements every 15 minutes. If the connection drops, messages should be stored on disk (to prevent message loss in case of power cut). They are sent later on when the connection comes back online. Does a service or client library exist that implements this or do we need to develop this ourselves?







      rabbitmq






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 9 at 19:46









      rept

      80211130




      80211130






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted











          Is there a way to keep the queue open, so messages are kept until the
          IoT device comes back online?




          Use a regular queue, and make sure it's durable if you'd like it to survive RabbitMQ restarts.




          Is there some way to have guaranteed delivery starting at the IoT
          device.




          That depends on the library you are using, but you don't tell us what library nor what protocol you're using (AMQP vs MQTT, for instance).



          Some libraries offer automatic reconnect and re-creation of topology (queues, exchanges, etc) but I'm not aware of any that offer local storage of messages until the broker is available again. You'll have to code that yourself.



          Please carefully read the documentation with regard to publisher confirmations and consumer acknowledgements, as those are both necessary for reliable messaging link.




          NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.






          share|improve this answer




















          • Thanks. We use AMQP. The IoT devices are connected through 4G to the cloud. So there aren't any libraries that cache the requests to the Queue locally on the IoT device if the connection to the RabbitMQ server can't be made? This to me would seem like a problem that many developers would face?
            – rept
            Nov 9 at 21:32










          • Like I said, I'm not aware of any libraries that do that for you. Since an AMQP message body is just a sequence of bytes, writing that data to local durable storage prior to sending the message and deleting it after getting the publisher confirmation shouldn't be too difficult.
            – Luke Bakken
            Nov 10 at 13:38










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53232369%2frabbitmq-and-iot-device-keep-queue-open%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted











          Is there a way to keep the queue open, so messages are kept until the
          IoT device comes back online?




          Use a regular queue, and make sure it's durable if you'd like it to survive RabbitMQ restarts.




          Is there some way to have guaranteed delivery starting at the IoT
          device.




          That depends on the library you are using, but you don't tell us what library nor what protocol you're using (AMQP vs MQTT, for instance).



          Some libraries offer automatic reconnect and re-creation of topology (queues, exchanges, etc) but I'm not aware of any that offer local storage of messages until the broker is available again. You'll have to code that yourself.



          Please carefully read the documentation with regard to publisher confirmations and consumer acknowledgements, as those are both necessary for reliable messaging link.




          NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.






          share|improve this answer




















          • Thanks. We use AMQP. The IoT devices are connected through 4G to the cloud. So there aren't any libraries that cache the requests to the Queue locally on the IoT device if the connection to the RabbitMQ server can't be made? This to me would seem like a problem that many developers would face?
            – rept
            Nov 9 at 21:32










          • Like I said, I'm not aware of any libraries that do that for you. Since an AMQP message body is just a sequence of bytes, writing that data to local durable storage prior to sending the message and deleting it after getting the publisher confirmation shouldn't be too difficult.
            – Luke Bakken
            Nov 10 at 13:38














          up vote
          0
          down vote



          accepted











          Is there a way to keep the queue open, so messages are kept until the
          IoT device comes back online?




          Use a regular queue, and make sure it's durable if you'd like it to survive RabbitMQ restarts.




          Is there some way to have guaranteed delivery starting at the IoT
          device.




          That depends on the library you are using, but you don't tell us what library nor what protocol you're using (AMQP vs MQTT, for instance).



          Some libraries offer automatic reconnect and re-creation of topology (queues, exchanges, etc) but I'm not aware of any that offer local storage of messages until the broker is available again. You'll have to code that yourself.



          Please carefully read the documentation with regard to publisher confirmations and consumer acknowledgements, as those are both necessary for reliable messaging link.




          NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.






          share|improve this answer




















          • Thanks. We use AMQP. The IoT devices are connected through 4G to the cloud. So there aren't any libraries that cache the requests to the Queue locally on the IoT device if the connection to the RabbitMQ server can't be made? This to me would seem like a problem that many developers would face?
            – rept
            Nov 9 at 21:32










          • Like I said, I'm not aware of any libraries that do that for you. Since an AMQP message body is just a sequence of bytes, writing that data to local durable storage prior to sending the message and deleting it after getting the publisher confirmation shouldn't be too difficult.
            – Luke Bakken
            Nov 10 at 13:38












          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted







          Is there a way to keep the queue open, so messages are kept until the
          IoT device comes back online?




          Use a regular queue, and make sure it's durable if you'd like it to survive RabbitMQ restarts.




          Is there some way to have guaranteed delivery starting at the IoT
          device.




          That depends on the library you are using, but you don't tell us what library nor what protocol you're using (AMQP vs MQTT, for instance).



          Some libraries offer automatic reconnect and re-creation of topology (queues, exchanges, etc) but I'm not aware of any that offer local storage of messages until the broker is available again. You'll have to code that yourself.



          Please carefully read the documentation with regard to publisher confirmations and consumer acknowledgements, as those are both necessary for reliable messaging link.




          NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.






          share|improve this answer













          Is there a way to keep the queue open, so messages are kept until the
          IoT device comes back online?




          Use a regular queue, and make sure it's durable if you'd like it to survive RabbitMQ restarts.




          Is there some way to have guaranteed delivery starting at the IoT
          device.




          That depends on the library you are using, but you don't tell us what library nor what protocol you're using (AMQP vs MQTT, for instance).



          Some libraries offer automatic reconnect and re-creation of topology (queues, exchanges, etc) but I'm not aware of any that offer local storage of messages until the broker is available again. You'll have to code that yourself.



          Please carefully read the documentation with regard to publisher confirmations and consumer acknowledgements, as those are both necessary for reliable messaging link.




          NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 9 at 21:16









          Luke Bakken

          2,4532812




          2,4532812











          • Thanks. We use AMQP. The IoT devices are connected through 4G to the cloud. So there aren't any libraries that cache the requests to the Queue locally on the IoT device if the connection to the RabbitMQ server can't be made? This to me would seem like a problem that many developers would face?
            – rept
            Nov 9 at 21:32










          • Like I said, I'm not aware of any libraries that do that for you. Since an AMQP message body is just a sequence of bytes, writing that data to local durable storage prior to sending the message and deleting it after getting the publisher confirmation shouldn't be too difficult.
            – Luke Bakken
            Nov 10 at 13:38
















          • Thanks. We use AMQP. The IoT devices are connected through 4G to the cloud. So there aren't any libraries that cache the requests to the Queue locally on the IoT device if the connection to the RabbitMQ server can't be made? This to me would seem like a problem that many developers would face?
            – rept
            Nov 9 at 21:32










          • Like I said, I'm not aware of any libraries that do that for you. Since an AMQP message body is just a sequence of bytes, writing that data to local durable storage prior to sending the message and deleting it after getting the publisher confirmation shouldn't be too difficult.
            – Luke Bakken
            Nov 10 at 13:38















          Thanks. We use AMQP. The IoT devices are connected through 4G to the cloud. So there aren't any libraries that cache the requests to the Queue locally on the IoT device if the connection to the RabbitMQ server can't be made? This to me would seem like a problem that many developers would face?
          – rept
          Nov 9 at 21:32




          Thanks. We use AMQP. The IoT devices are connected through 4G to the cloud. So there aren't any libraries that cache the requests to the Queue locally on the IoT device if the connection to the RabbitMQ server can't be made? This to me would seem like a problem that many developers would face?
          – rept
          Nov 9 at 21:32












          Like I said, I'm not aware of any libraries that do that for you. Since an AMQP message body is just a sequence of bytes, writing that data to local durable storage prior to sending the message and deleting it after getting the publisher confirmation shouldn't be too difficult.
          – Luke Bakken
          Nov 10 at 13:38




          Like I said, I'm not aware of any libraries that do that for you. Since an AMQP message body is just a sequence of bytes, writing that data to local durable storage prior to sending the message and deleting it after getting the publisher confirmation shouldn't be too difficult.
          – Luke Bakken
          Nov 10 at 13:38

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53232369%2frabbitmq-and-iot-device-keep-queue-open%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo