Exemple #1
0
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)
Exemple #2
0
 def __init__(self,
              endpoint=DEFAULT_ENDPOINT_STATS,
              ssh_server=None,
              context=None):
     CircusConsumer.__init__(self, ['stat.'], context, endpoint, ssh_server)
Exemple #3
0
 def __init__(self, endpoint=DEFAULT_ENDPOINT_STATS, ssh_server=None,
              context=None):
     CircusConsumer.__init__(self, ['stat.'], context, endpoint, ssh_server)
Exemple #4
0
 def __init__(self, endpoint='tcp://127.0.0.1:5557', context=None):
     CircusConsumer.__init__(self, ['stat.'], context, endpoint)
Exemple #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
Exemple #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
Exemple #7
0
 def __init__(self, endpoint='tcp://127.0.0.1:5557', context=None):
     CircusConsumer.__init__(self, ['stat.'], context, endpoint)