Created
July 1, 2019 23:00
-
-
Save ipeluffo/f37f4404f5e0d80dc01072a005308849 to your computer and use it in GitHub Desktop.
Tweets hashtags real-time processing with Faust - Agent
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
hashtags_topic = app.topic('hashtags', value_type=str) | |
hashtags_counts_table = app.Table('hashtags_counts', default=int) | |
@app.agent(hashtags_topic) | |
async def hashtags_counter(hashtags) -> None: | |
async for hashtag in hashtags: # type: str | |
hashtags_counts_table[hashtag] += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment