Skip to content

Commit

Permalink
fixed a few small mistakes in streams userguide (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
peonone authored Jun 17, 2021
1 parent fbaae90 commit c45a464
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/userguide/streams.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ have processed so we can commit and advance the consumer group offset.
We use reference counting for this, so when you define an agent that
iterates over the topic as a stream::

@app.agent(topic)
async def process(stream):
async for value in stream:
@app.agent(topic)
async def process(stream):
async for value in stream:
print(value)

The act of starting that stream iterator will add the topic to
Expand Down Expand Up @@ -206,8 +206,8 @@ If two agents use streams subscribed to the same topic::

@app.agent(topic)
async def processA(stream):
async for value in stream:
print(f'A: {value}')
async for value in stream:
print(f'A: {value}')

@app.agent(topic)
async def processB(stream):
Expand Down Expand Up @@ -239,13 +239,13 @@ What this means is that an event is acknowledged when your agent is
finished handling it, but you can also manually control when it happens.

To manually control when the event is acknowledged, and its reference count
decreased, use ``await event.ack()``
decreased, use ``await event.ack()``::

async for event in stream.events():
print(event.value)
await event.ack()
async for event in stream.events():
print(event.value)
await event.ack()

You can also use :keyword:`async for` on the event::
You can also use :keyword:`async with` on the event::

async for event in stream.events():
async with event:
Expand Down

0 comments on commit c45a464

Please sign in to comment.