On 2013-11-15 18:42, Dougie Lawson wrote:
> On 14 November 2013 08:31, Paul Fremantle <
pa...@wso2.com [1]> wrote:
>
>> Dougie
>>
>> Excellent points.
>>
>> What do you think about putting the config in a database and then
>> regularly updating a topic with the config? That way the client can
>> have a simple subscription while there is a clear approach to
>> restart/recovery.
>>
>> Paul
>
> Hi Paul,
>
> My approach would be to have a long-running server connected to MQTT
> subscribed to a special topic.
>
> The user needing config data would publish a message on that topic
> with the data needed to form a coherent SQL predicate.
>
> The server gets the predicate, sanity checks it (because we should
> always sanity check SQL predicate that arrive from outside our
> domain), then feeds it into an SQL SELECT query to retrieve the
> required rows.
>
> It then publishes those rows on a reply topic.
>
> Effectively youve written a simply transaction processor. You may
> need
> to consider some form of authorisation for that.
>
> Should be simple with something like python to knock that up in half
> a
> day.
Thanks for suggesting an alternative approach. Makes a lot of sense
doing this over MQTT, rather than having to implement multiple
application protocols on the device.
The extra layer of protocol also gives a lot more options and would
make auto-provisioning of sensor configuration easier. It would also
make it much easier to report error conditions with persisting to the
data store.
However it feels an awful lot like RPC over PubSub, which scares me a
bit!
Is that a good thing or a bad thing?
I instinctively try and make MQTT resource centric - but then you have
a very limited set of verbs...
nick.