Exemplo n.º 1
0
    def on_partitions_revoked(
            self, revoked: Iterable[_TopicPartition]) -> Awaitable:
        """Call when partitions are being revoked."""
        thread = self._thread
        # XXX Must call app.on_rebalance_start as early as possible.
        # we call this in the sync method, this way when we know
        # that it will be called even if await never returns to the coroutine.
        thread.app.on_rebalance_start()

        # this way we should also get a warning if the coroutine
        # is never awaited.
        return thread.on_partitions_revoked(ensure_TPset(revoked))
Exemplo n.º 2
0
 def assignment(self) -> Set[TP]:
     """Return the current assignment."""
     return ensure_TPset(self._ensure_consumer().assignment())
Exemplo n.º 3
0
 async def on_partitions_assigned(
         self, assigned: Iterable[_TopicPartition]) -> None:
     """Call when partitions are being assigned."""
     await self._thread.on_partitions_assigned(ensure_TPset(assigned))
Exemplo n.º 4
0
 async def on_partitions_assigned(
         self, assigned: Iterable[_TopicPartition]) -> None:
     await self._thread.on_partitions_assigned(ensure_TPset(assigned))
Exemplo n.º 5
0
 async def on_partitions_revoked(
         self, revoked: Iterable[_TopicPartition]) -> None:
     await self._thread.on_partitions_revoked(ensure_TPset(revoked))
Exemplo n.º 6
0
 def assignment(self) -> Set[TP]:
     return ensure_TPset(self._ensure_consumer().assignment())