diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-11-17 16:38:04 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-11-17 16:38:04 +0000 |
commit | 07bc5c36dd039dd88ee105a9a254d92556d2df6c (patch) | |
tree | 82cf9419721c997bf0306568e7dae3f5873db88c /py/demo/Ice/async/Publisher.py | |
parent | Fixed build (diff) | |
download | ice-07bc5c36dd039dd88ee105a9a254d92556d2df6c.tar.bz2 ice-07bc5c36dd039dd88ee105a9a254d92556d2df6c.tar.xz ice-07bc5c36dd039dd88ee105a9a254d92556d2df6c.zip |
Added AMI/AMD demo
Diffstat (limited to 'py/demo/Ice/async/Publisher.py')
-rw-r--r-- | py/demo/Ice/async/Publisher.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/py/demo/Ice/async/Publisher.py b/py/demo/Ice/async/Publisher.py new file mode 100644 index 00000000000..73f3028de9b --- /dev/null +++ b/py/demo/Ice/async/Publisher.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys, traceback, Ice + +Ice.loadSlice('Queue.ice') +import Demo + + +def menu(): + print "Enter /quit to exit." + +class Publisher(Ice.Application): + def run(self, args): + properties = self.communicator().getProperties() + refProperty = 'Queue.Proxy' + proxy = properties.getProperty(refProperty) + if len(proxy) == 0: + print args[0] + ": property `" + refProperty + "' not set" + return False + + queue = Demo.QueuePrx.checkedCast(self.communicator().stringToProxy(proxy)) + if not queue: + print args[0] + ": invalid proxy" + return False + + print "Type a message and hit return to queue a message." + menu() + + line = None + try: + while 1: + line = raw_input("==> ") + if len(line) != 0: + if line[0] == '/': + if line == "/quit": + break + menu() + else: + queue.add(line) + except EOFError: + return False + except Ice.Exception, ex: + print ex + + return True + +app = Publisher() +sys.exit(app.main(sys.argv, "config.client")) |