<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/113352/multi-instance-backend-subscribing-to-mqtt-topic</link><description>Hi, I am wondering about the best way to handle the case where my backend is subscribing to MQTT topics in NFR cloud, when I am running multiple instances of it, for example in Kubernetes. 
 The requirement is that one of the instances should get one</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Aug 2024 01:59:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/113352/multi-instance-backend-subscribing-to-mqtt-topic" /><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/498528?ContentTypeID=1</link><pubDate>Fri, 16 Aug 2024 01:59:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7741d07c-ffdb-41b3-8465-0755d8be44ad</guid><dc:creator>Lincoln Thomas</dc:creator><description>&lt;p&gt;Hi Rasmus,&lt;/p&gt;
&lt;p&gt;I have created 3 more account devices and sent their credentials to your email.&lt;/p&gt;
&lt;p&gt;If they work for you, and you still need more account devices, I can create them, but it is a manual process.&lt;/p&gt;
&lt;p&gt;We will soon be supporting user creation of multiple account devices.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Lincoln&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/497559?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2024 07:08:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb5c96e8-4a57-4513-859d-c18cc6bc65cb</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Hi Rasmus,&lt;/p&gt;
&lt;p&gt;Here is a reply from our nRF Cloud developer, could you provide your team ID and account devices&amp;nbsp;amount you what you need?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Only 1 account device is allowed now, and the supported &lt;a id="menurehk" class="fui-Link ___1rxvrpe f2hkw1w f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1hu3pq6 f11qmguv f19f4twv f1tyq0we f1g0x7ka fhxju0i f1qch9an f1cnd47f fqv5qza f1vmzxwi f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1lqvz6u f10aw75t fsle3fq f17ae5zn" title="https://api.nrfcloud.com/" href="https://api.nrfcloud.com/" rel="noopener noreferrer" target="_blank"&gt;REST API&lt;/a&gt; endpoints to use are:&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;GetAccountDeviceCertificate&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;RotateAccountDeviceCertificate&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;DeleteAccountDevice&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;The mentions in the DevZone ticket about CreateAccountDeviceAndCertificate and related endpoints are deprecated equivalents that should not be used. They do NOT allow creation of more than one account device, just like the &amp;nbsp;3 bulleted supported endpoints above do not allow more than one.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;We are considering adding feature support to allow creation of multiple account devices, but it&amp;#39;s not possible now by the user. But we can create the 2nd, 3rd, etc account devices for them manually and give them the client device IDs and certs, if we have their team ID.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Charlie&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/497183?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2024 14:00:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9a0a151-c221-4cae-a4ca-54c759a915f6</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Hi Rasmus,&lt;/p&gt;
&lt;p&gt;I will forward your request to&amp;nbsp;our nRF Cloud team to see if we could figure out a solution.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Charlie&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/496877?ContentTypeID=1</link><pubDate>Sat, 03 Aug 2024 11:29:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbc3feb2-2e8b-4fb3-bfdd-84aaefe4e19e</guid><dc:creator>Rasmus K</dc:creator><description>&lt;p&gt;Hi Charlie,&amp;nbsp;that&amp;#39;s okay.&lt;/p&gt;
&lt;p&gt;Yes I saw that endpoint, but it says it&amp;#39;s deprecated and should not be used. The suggested endpoint to use instead&amp;nbsp;&lt;a href="https://api.nrfcloud.com/v1#tag/Account-Devices/operation/CreateAccountDevice"&gt;https://api.nrfcloud.com/v1#tag/Account-Devices/operation/CreateAccountDevice &lt;/a&gt;- specifically says:&lt;/p&gt;
&lt;p&gt;&amp;quot;When a new account device (and subsequent certificate) is created, both the public AND private keys are returned. If an account device already exists, only the public key is returned. If the private key is lost, the certificate should be rotated to obtain a new public/private key pair&amp;quot;.&lt;/p&gt;
&lt;p&gt;This conforms with the result of my attempt trying it, i.e. the second time I call the endpoint I get the same&amp;nbsp;clientId back as well as the public key. Limiting me to only have one of these account devices created. So, there is no way for me to connect to the NRF MQTT broker with different device ID:s (client ID:s) since those are tied to a&amp;nbsp;account device, which I can only create one of.&lt;/p&gt;
&lt;p&gt;Is this by design, or?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Rasmus&lt;/p&gt;
&lt;p&gt;EDIT: I did try the deprecated endpoint as well that you provided, that does not create a new&amp;nbsp;account device either if I already have one. It only returns the same information of the one already created.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/496832?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2024 13:45:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b80dbeab-7cb9-43c6-a530-9ee9648a1514</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Hi Rasmus,&lt;/p&gt;
&lt;p&gt;Sorry for misunderstanding. I forget you are using MQTT clients on your cloud side.&lt;/p&gt;
&lt;p&gt;For you questions,&lt;/p&gt;
[quote user="Rasmus K"]Is there no way to create more account devices?[/quote]
&lt;p&gt;There is no limitation to create account devices on nRF Cloud&amp;nbsp;&lt;a href="https://api.nrfcloud.com/v1#tag/Account/operation/CreateAccountDeviceAndCertificate"&gt;nRF Cloud REST API Documentation&lt;/a&gt;, but you are trying to run MQTT clients with same account device ID, this is not allowed by MQTT &lt;span&gt;Spec&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/59625907/how-to-handle-multiple-clients-with-same-id-in-mosquitto-mqtt"&gt;How to handle multiple clients with same ID in mosquitto MQTT? - Stack Overflow&lt;/a&gt;&lt;/p&gt;
[quote user="Rasmus K"]Is there another, recommended way for my backend to subscribe to live&amp;nbsp;location events instead of subscribing to&amp;nbsp;appropriate MQTT topics?[/quote]
&lt;p&gt;If you are sensitive to the location update time delay, a direct connection and update to your cloud could be the solution. Even the MQTT PUB/SUB introduces delay.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Charlie&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/496789?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2024 10:06:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2cf40b2a-5256-4236-801f-f08fac15aaed</guid><dc:creator>Rasmus K</dc:creator><description>&lt;p&gt;Yes, we have thought about self hosting our own MQTT broker. However we wanted to explore a managed solution first. FOTA etc is supported out of the box for most managed solutions AFAIK.&lt;/p&gt;
&lt;p&gt;Is it possible to provide answers to my questions? AWS IoT (which NRF cloud is based on AFAIK) does not have a limitation on how many &amp;quot;things&amp;quot; can be created (which I guess is the account device in NRF cloud). So another solution would be to use our own AWS IoT infra, bypassing NRF cloud, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/496612?ContentTypeID=1</link><pubDate>Thu, 01 Aug 2024 12:13:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d85b255-90cb-4878-8c90-541c9f9f2fcd</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;&lt;span&gt;Have you thought about using EMQX which already supports K8s deployment?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://www.emqx.com/en/blog/running-mqtt-on-kubernetes"&gt;Running MQTT on Kubernetes: A Practical Guide | EMQ (emqx.com)&lt;/a&gt;&lt;br /&gt;EMQX is the leading open source MQTT broker. It provides a Docker Official Image which is&amp;nbsp;&lt;/span&gt;&lt;a href="https://hub.docker.com/_/emqx"&gt;available on Docker Hub&lt;/a&gt;&lt;span&gt;&amp;nbsp;and an open source&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/emqx/emqx-operator"&gt;Kubernetes operator&lt;/a&gt;&lt;span&gt;, which supports the free and open source version of EMQX.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/496586?ContentTypeID=1</link><pubDate>Thu, 01 Aug 2024 10:25:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9b18659-d70e-44e2-935a-1b18671f1765</guid><dc:creator>Rasmus K</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;again Charlie,&lt;/p&gt;
&lt;p&gt;I revised my solution to enable all my replicas to subscribe to&amp;nbsp;MQTT topics of devices which are connected to my API and should be provided with live location updates. However I have encountered an issue, namely that I can only create one account device. As the MQTT broker prevents me from connecting with the same client ID, I need to use different ones (and different account devices, right?) so my thought was to have multiple, pooled account devices which my replicas can pick from when connecting to the MQTT broker. Which leads me to some questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Is there no way to create more account devices?&lt;/li&gt;
&lt;li&gt;Is there another, recommended way for my backend to subscribe to live&amp;nbsp;location events instead of subscribing to&amp;nbsp;appropriate MQTT topics?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Thanks in advance,&lt;/p&gt;
&lt;p&gt;Rasmus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/495876?ContentTypeID=1</link><pubDate>Sat, 27 Jul 2024 16:02:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36e5bb35-0286-4107-8253-4953b536ec0e</guid><dc:creator>Rasmus K</dc:creator><description>&lt;p&gt;Yes, for now I am using a simple leader election mechanism (backed by postgresql) - which means one of my replicas will be elected as a leader, and the leader subscribes to the MQTT topics. In the future I might want to use compute across my replicas to receive MQTT messages, then I need to change this approach.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Rasmus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/495542?ContentTypeID=1</link><pubDate>Thu, 25 Jul 2024 07:06:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ddc3a33-0901-4dea-8f01-e6f8a6a2090a</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Hi Rasmus,&lt;/p&gt;
&lt;p&gt;We can keep this ticket open to see if there are any other developers will share their solutions.&lt;/p&gt;
&lt;p&gt;Feel free to give an update if you solve this challenge by yourself.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Charlie&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/495476?ContentTypeID=1</link><pubDate>Wed, 24 Jul 2024 15:21:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5453e8f0-5684-4c27-a18e-af76b1571d09</guid><dc:creator>Rasmus K</dc:creator><description>&lt;p&gt;Hi Charlie,&lt;/p&gt;
&lt;p&gt;Thanks I understand. I was thinking there must be others wanting to subscribe to the MQTT topics from&amp;nbsp;device accounts to process the data in their applications. And nowadays it&amp;#39;s just so common to run multiple replicas/instances of your application.&lt;/p&gt;
&lt;p&gt;Do you think we should keep this open for a while or close it?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Rasmus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi instance backend subscribing to MQTT topic</title><link>https://devzone.nordicsemi.com/thread/495427?ContentTypeID=1</link><pubDate>Wed, 24 Jul 2024 13:11:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:795298e3-10ca-486c-988c-c5da0be017be</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Hi Rasmus,&lt;/p&gt;
&lt;p&gt;We do not have much experience on &lt;span&gt;multiple instances&amp;nbsp;&lt;/span&gt;MQTT client implementation since our focus is on single MQTT client on IoT device mostly.&lt;/p&gt;
&lt;p&gt;You may reach to MQTT or&amp;nbsp;&lt;span&gt;Kubernetes forum to get more professional advice.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Charlie&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>