Batched message methods now return dict of lists

This commit is contained in:
Dana Powers
2016-01-02 13:21:16 -08:00
parent 24a4c2a7c5
commit 00a1e6e819
2 changed files with 4 additions and 4 deletions

View File

@@ -267,14 +267,14 @@ class Fetcher(six.Iterator):
AssertionError: if used with iterator (incompatible)
Returns:
dict: {TopicPartition: deque([messages])}
dict: {TopicPartition: [messages]}
"""
assert self._iterator is None, (
'fetched_records is incompatible with message iterator')
if self._subscriptions.needs_partition_assignment:
return {}
drained = collections.defaultdict(collections.deque)
drained = collections.defaultdict(list)
self._raise_if_offset_out_of_range()
self._raise_if_unauthorized_topics()
self._raise_if_record_too_large()

View File

@@ -343,7 +343,7 @@ class KafkaConsumer(six.Iterator):
records that are available now. Must not be negative. Default: 0
Returns:
dict: topic to deque of records since the last fetch for the
dict: topic to list of records since the last fetch for the
subscribed list of topics and partitions
"""
assert timeout_ms >= 0, 'Timeout must not be negative'
@@ -377,7 +377,7 @@ class KafkaConsumer(six.Iterator):
timeout_ms (int): The maximum time in milliseconds to block
Returns:
dict: map of topic to deque of records (may be empty)
dict: map of topic to list of records (may be empty)
"""
# TODO: Sub-requests should take into account the poll timeout (KAFKA-1894)
self._coordinator.ensure_coordinator_known()