예제 #1
0
파일: bread.py 프로젝트: zerok/circus
def api():
    """WebSocket endpoint; Takes a 'topic' GET param."""
    ws = request.environ.get('wsgi.websocket')
    topic = request.args.get('topic')

    if None in (ws, topic):
        return

    topic = topic.encode('ascii')
    for message, message_topic in CircusConsumer(topic, endpoint=ZMQ_ENDPOINT):
        response = json.dumps(dict(message=message, topic=message_topic))
        ws.send(response)
예제 #2
0
파일: client.py 프로젝트: max19931/circus
 def __init__(self,
              endpoint=DEFAULT_ENDPOINT_STATS,
              ssh_server=None,
              context=None):
     CircusConsumer.__init__(self, ['stat.'], context, endpoint, ssh_server)
예제 #3
0
파일: client.py 프로젝트: bbinet/circus
 def __init__(self, endpoint=DEFAULT_ENDPOINT_STATS, ssh_server=None,
              context=None):
     CircusConsumer.__init__(self, ['stat.'], context, endpoint, ssh_server)
예제 #4
0
파일: client.py 프로젝트: daker/circus
 def __init__(self, endpoint='tcp://127.0.0.1:5557', context=None):
     CircusConsumer.__init__(self, ['stat.'], context, endpoint)
예제 #5
0
 def handle_sub(self, cmd, opts, topics, endpoint, timeout, ssh_server,
                ssh_keyfile):
     consumer = CircusConsumer(topics, endpoint=endpoint)
     for topic, msg in consumer:
         print("%s: %s" % (topic, msg))
     return 0
예제 #6
0
from circus.consumer import CircusConsumer
import json

ZMQ_ENDPOINT = 'tcp://127.0.0.1:5556'
topic = 'show:'

for message, message_topic in CircusConsumer(topic, endpoint=ZMQ_ENDPOINT):
    response = json.dumps(dict(message=message, topic=message_topic))
    print response
예제 #7
0
 def __init__(self, endpoint='tcp://127.0.0.1:5557', context=None):
     CircusConsumer.__init__(self, ['stat.'], context, endpoint)