Created
March 31, 2019 10:16
-
-
Save chobeat/50e2a91dba6e90f4debd515a2cfbfdfc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import faust | |
app = faust.App("debug", broker="localhost:9092") | |
def a(mess): | |
print("I'm a") | |
print(mess) | |
def b(mess): | |
print("I'm b") | |
print(mess) | |
def c(mess): | |
print("I'm c") | |
print(mess) | |
for transformation, topic in [(a,"a"),(b,"b"),(c,"c")]: | |
async def _func(messages): | |
async for message in messages: | |
transformation(message) | |
_func.__name__="transformation_"+topic | |
app.agent(app.topic(topic, | |
value_serializer="raw"), name="transformation_"+topic)(_func) | |
def main(): | |
app.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment