Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Publish messages transactionally with your other database operations.
from sqlalchemy.ext.asyncio import create_async_engine

from faststream import FastStream
from faststream.kafka import KafkaBroker
from faststream.kafka import KafkaBroker, KafkaPublishMessage

from faststream_sqlbroker import SqlBroker
from faststream_sqlbroker import SqlBroker, SqlBrokerMessage

engine = create_async_engine("postgresql+asyncpg://user:pass@localhost/mydb")
broker_sqlbroker = SqlBroker(engine=engine)
Expand All @@ -41,15 +41,11 @@ async def publish_examples():
},
connection=connection,
)

```

And relay the messages from the database to another broker.

```python linenums="1"
from faststream.kafka import KafkaPublishMessage
from faststream_sqlbroker import SqlBrokerMessage

publisher_kafka = broker_kafka.publisher("kafka_topic")


Expand All @@ -60,7 +56,6 @@ publisher_kafka = broker_kafka.publisher("kafka_topic")
min_fetch_interval=0,
fetch_batch_size=10,
flush_interval=3,
release_stuck_interval=5,
)
async def handle_msg(
msg_body: dict,
Expand All @@ -73,7 +68,6 @@ async def handle_msg(
},
key=msg.headers["x-kafka-key-source"].encode(),
)

```

## Origins
Expand Down