Making Gemstone/s sending events to external programs

In all my programming experiences with Gemstone/S I have one problem which is not solved in a very good way: how can external program be informed about changes in the database they are perhaps interested in.

The most common answer to this question is: polling. I do it in all languages PUM is supporting: Python, ExtJS, C# or VASmalltalk. Make a REST request to the database in a periodical time and consume the result.

Ok, I’m now consider changing this in a fundamental way. In the past I used 0MQ several times and with 0MQ I consider making Gemstone/s more active to client programs.

The whole “incoming-request”-“handle resquest”-“commit or abort” cycle I add an additional cycle: “send notification”:

“incoming-request”-“handle request”-“commit or abort”-“send notification”

All topaz scripts (or the HTTP request script) open a PUSH socket to a python script offering an pull-socket. So we have a n:1 socket connection.

After each commit (an abort seems to be not that interesting) the http-smalltalk code send an event with a topic and perhaps an additional information via its PUSH socket to python program. This one serializes all incoming requests via its PULL socket and transfer the contents to a PUB-socket (also opened in the same program).

All to be written external service programs must have now SUB (subscribe) sockets opened to the PUB-socket of the python program and (whatever they subscribe) they receive the informations from the now more active Gemstone database – which can now be called and event oriented database :-))))

This entry was posted in Smalltalk and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s