-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1686 from langchain-ai/nc/11sep/kafka-configurabl…
…e-consumer-producer kafka: Make consumer and producer classes configurable
- Loading branch information
Showing
5 changed files
with
194 additions
and
115 deletions.
There are no files selected for viewing
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
16 changes: 16 additions & 0 deletions
16
libs/scheduler-kafka/langgraph/scheduler/kafka/default_async.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import dataclasses | ||
from typing import Any, Sequence | ||
|
||
import aiokafka | ||
|
||
|
||
class DefaultAsyncConsumer(aiokafka.AIOKafkaConsumer): | ||
async def getmany( | ||
self, timeout_ms: int, max_records: int | ||
) -> dict[str, Sequence[dict[str, Any]]]: | ||
batch = await super().getmany(timeout_ms=timeout_ms, max_records=max_records) | ||
return {t: [dataclasses.asdict(m) for m in msgs] for t, msgs in batch.items()} | ||
|
||
|
||
class DefaultAsyncProducer(aiokafka.AIOKafkaProducer): | ||
pass |
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
Oops, something went wrong.