I want to create a topic that is automatically compacted by kafka, using faust stream. I use code like:
import asyncio
import random
import faust
app = faust.App(
'mysample',
broker=<...>,
value_serializer='raw',
key_serializer='raw',
topic_replication_factor=3,
)
topic = app.topic('mytest5', partitions=1, compacting=True, acks=False)
count = 1
@app.timer(2.0, on_leader=True)
async def publish_greetings():
global count
print('PUBLISHING ON LEADER!')
await topic.send(key=str(count), value=str(random.random()))
count += 1
@app.agent(topic)
async def say(greetings):
async for k, v in greetings.items():
print(f'{k}, {v}')
I've tried also options internal
, retention
, deleting
with topic creation and every time I changed the topic name, so the new topic should have been created. But I don't see the kafka actually compacts the topic. Every time I read the topic I see the full event history.
How to create a compacting topic with faust?