from __future__ import print_function
import Pyro4
from messagebus.messagebus import Subscriber
from Pyro4.util import excepthook
import sys

sys.excepthook = excepthook

Pyro4.config.AUTOPROXY = True


@Pyro4.expose()
class Subber(Subscriber):
    def consume_message(self, topic, message):
        print("\nGOT MESSAGE:")
        print("   topic:", topic)
        print("   msgid:", message.msgid)
        print(" created:", message.created)
        print("    data:", message.data)


subber = Subber()
d = Pyro4.Daemon()
d.register(subber)

subber.bus.subscribe("weather-forecast", subber)
# note: we subscribe on the bus *after* registering the subber as a Pyro object
# this results in Pyro automatically making a proxy for the subber
print("Subscribed on weather-forecast")
d.requestLoop()

@@ -480,16 +480,101 @@
 data)%0A%0A%0A
+if len(sys.argv) != 2:%0A    raise SystemExit(%22give hostname to bind on as argument%22)%0A%0A
 subber =
@@ -600,16 +600,40 @@
 .Daemon(
+host=sys.argv%5B1%5D.strip()
 )%0Ad.regi

allow changing the hostname to bind on for the messagebus subscriber