Skip to content

Instantly share code, notes, and snippets.

@ipeluffo
Created July 1, 2019 23:00
Show Gist options
  • Save ipeluffo/f37f4404f5e0d80dc01072a005308849 to your computer and use it in GitHub Desktop.
Save ipeluffo/f37f4404f5e0d80dc01072a005308849 to your computer and use it in GitHub Desktop.
Tweets hashtags real-time processing with Faust - Agent
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