コード例 #1
0
ファイル: dump.py プロジェクト: turboza/quark
def main():
    counter = 0
    topic = Topic("http://127.0.0.1:8080", "t")
    while True:
        value = topic.pop()
        print("{}: {} {}".format(topic.name, counter, value))
        counter += 1
        time.sleep(1)
コード例 #2
0
ファイル: square.py プロジェクト: turboza/quark
def main():
    t = Topic("http://127.0.0.1:8080", "t")
    tracked = set()
    while True:
        pieces = t.pop().split(":")
        print pieces
        if pieces[0] in tracked:
            if pieces[1] == "done":
                tracked.remove(pieces[0])
            else:
                value = int(pieces[1])
                t.push("squared:" + pieces[0] + ":" + str(value * value))
        elif pieces[0] == "square":
            tracked.add(pieces[1])
コード例 #3
0
def main():
    topic = Topic("http://127.0.0.1:8080", "t")
    topic.push("sequence:10:fdsa")
    topic.push("square:fdsa")