[racket] Internet of Things

From: Jukka Tuominen (jukka.tuominen at finndesign.fi)
Date: Sat Feb 15 05:06:05 EST 2014

Took a while to get back to this. Happened so far:

I gave up on zeromq, since the sub client kept crashing every time.
Rabbitmq/stomp examples worked over a public server with a guest user, so I set up a server of my own. Once a basic pub-sub messaging in place, I created a simple message handler, that can recognize racket expressions
and evaluate them (or do what ever). I even got it to evaluate liitin
expressions.

I got really excited, since having thought about it a bit further, not
only is it suitable for device or other service control, but one could
even make it a generic way for messaging between liitin accounts. For example, since each liitin account has a protected namespace, this kind of messaging allows creating "pull-requests" to update liitin objects across namespaces. You can accept them either manually or automatically based on your message handler.

But I'm only starting to get familiar with rabbitmq and stomp, and to
achieve what I want, I need a full control of both client and server
sides. I planning to use racket also for creating the needed server-side
shell commands dynamically, and mix them with higher-level functionality.

Now I'm stuck. As mentioned earlier, everything works nicely with the
built-in "guest" user, but once trying to create a "messaging channel" for
a new liitin account (user/device/service) I'm obviously missing something.

I use the following shell commands on the server side:

rabbitmqctl add_vhost /device5
rabbitmqctl add_user user device5 password
rabbitmqctl set_permissions -p /device5 ".*" ".*" ".*"

And based on the racket/stomp pub example,
http://planet.racket-lang.org/package-source/tonyg/stomp.plt/2/1/planet-docs/manual/index.html
chapter 2.2
... I send a message (no error).


But based on the sub example (chapter 2.3), when I try to receive it, a plain "error" is signaled highlighting
"stomp-next-message s "my-subscription"

I'm propably missing a level or two on top of the vhost, or the subscription definition on the client side is somehow invalid.

Any idea what I'm doing wrong?

Br, jukka



> On 18.11.2013, at 20.42, Jukka Tuominen <jukka.tuominen at finndesign.fi>
wrote:
> 
> Hi Tony,
> 
> 
>> On 18.11.2013, at 16.13, Tony Garnock-Jones <tonyg at ccs.neu.edu> wrote:
>> 
>> Hi Jukka,
>> 
>>> On 2013-11-16 1:48 AM, Jukka Tuominen wrote:
>>> I was happy to hear about the package Marketplace [...], and I wonder
>>> if it could be used as a starting point?
>> 
>> Marketplace is still in flux. It could be useful as a way of forcing
>> yourself to really *commit* to the idea of pub/sub-all-the-way-down ;-)
>> but it might not be the best choice to build a production system on top
>> just yet.
> 
> Ok, good to know. As far as I can see, an off-the-shelf pub-sub system
is propably enough for this purpose, and I'm not really planning on
studying the pub-sub itself, but rather how to utilize it.
> I'd very much like to choose a system that is robust and can scale up,
eventhough at this phase and in my hands, a p-o-c is the level that I'm
targetting.
>> 
>> Marketplace was inspired by, and can be seen as a generalization of,
>> ordinary pub/sub and queueing middleware like STOMP servers and RabbitMQ.
>> 
>>> Another option is to choose some generic open-source pub-sub server,
>>> and make the user and device ends speak racket.
>> 
>> I suggest looking into the STOMP protocol support for RabbitMQ. I wrote
>> a Racket STOMP client [1, 2] a while back that might do what you need.
> 
> I'll look into those, thanks!
> 
>> One of the things I've been meaning to do is write a simple *server* in
>> Racket to go along with it, but for now using RabbitMQ or similar is
>> probably a good bet.
> 
> I'm hoping to have the environment ready to use for a basic user, and
familiar for a developer as if dealing with any software objects. I have
a clear picture in my mind...
>> 
>> (Regarding Arduino: RabbitMQ also has experimental UDP support [3] which
>> might be of interest in this connection.)
> 
> Sounds very good! So far, I try to restrain myself from moving to even
more foreign terrain until I get the architecture easy enough for me and
others to use.
> 
> Br, jukka
> 
> 
>> 
>> Regards,
>> Tony
>> 
>> [1] http://planet.racket-lang.org/display.ss?package=stomp.plt&owner=tonyg
>> [2]https://github.com/tonyg/racket-stomp
>> [3] https://github.com/tonyg/udp-exchange
> 
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140215/43bce96f/attachment-0001.html>

Posted on the users mailing list.