Skip to content
Open
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
38 changes: 12 additions & 26 deletions faust/transport/drivers/confluent.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ async def create_topic(self,
deleting: bool = None,
ensure_created: bool = False) -> None:
"""Create topic on broker."""
return # XXX
raise NotImplementedError(
'Topic creation is not supported by the Confluent consumer'
)
await self._thread.create_topic(
topic,
partitions,
Expand Down Expand Up @@ -352,7 +354,9 @@ def key_partition(self,
topic: str,
key: Optional[bytes],
partition: int = None) -> Optional[int]:
raise NotImplementedError('TODO') # TODO XXX
raise NotImplementedError(
'Partition lookup is not supported by the Confluent consumer'
)


class ProducerProduceFuture(asyncio.Future):
Expand Down Expand Up @@ -478,23 +482,9 @@ async def create_topic(self,
deleting: bool = None,
ensure_created: bool = False) -> None:
"""Create topic on broker."""
return # XXX
_retention = (int(want_seconds(retention) * 1000.0)
if retention else None)
await cast(Transport, self.transport)._create_topic(
self,
self._producer.client,
topic,
partitions,
replication,
config=config,
timeout=int(want_seconds(timeout) * 1000.0),
retention=_retention,
compacting=compacting,
deleting=deleting,
ensure_created=ensure_created,
)

raise NotImplementedError(
'Topic creation is not supported by the Confluent producer'
)
async def on_start(self) -> None:
"""Call when producer is starting."""
await self._producer_thread.start()
Expand All @@ -519,12 +509,6 @@ async def send(self, topic: str, key: Optional[bytes],
on_delivery=fut.set_from_on_delivery,
)
return cast(Awaitable[RecordMetadata], fut)
try:
return cast(Awaitable[RecordMetadata], await self._producer.send(
topic, value, key=key, partition=partition))
except KafkaException as exc:
raise ProducerSendError(f'Error while sending: {exc!r}') from exc

async def send_and_wait(self, topic: str, key: Optional[bytes],
value: Optional[bytes],
partition: Optional[int],
Expand All @@ -548,7 +532,9 @@ async def flush(self) -> None:

def key_partition(self, topic: str, key: bytes) -> TP:
"""Return topic and partition destination for key."""
raise NotImplementedError()
raise NotImplementedError(
'Partition lookup is not supported by the Confluent producer'
)


class Transport(base.Transport):
Expand Down