How Midgard 2 talks between between machines
Posted on 2008-10-25 19:30:48 EEST.
I gave today a workshop about the basic functionalities of Midgard 2. One of them is the dbus signaling and it's possibilities. After that we hade quite intense hacking session with XMPP and Midgard 2. And what did we archive?
I described in one of my blogposts how easy it is to signal. So when some code is added, I can send serialized midgard objects via XMPP
Basically there's some normal code for initialization for the dbus and twisted framework in python but the magic happens with
# initialization code
....
def replicate:
# some preparing code for connection etc
msg = domish.Element(("jabber:client", "message"))
msg["to"] = "bergie@example.net"
body = msg.addElement("body", content = replicationpackage)
self.xmlstream.send(msg)
mbus = midgard.dbus("/mgdschema/midgard_page/create")
mbus.connect("notified", replicate, "foo")
Now we need a working receiver and probably Bergie is going to tell about is some more. This rocks we'll may have sooner than expected some P2P applications with Midgard.
