-
Notifications
You must be signed in to change notification settings - Fork 164
Closed
Description
Hi all,
I'm not sure whether I don't understand how stream/3 is supposed to work, or it's buggy:
defmodule KafkaTest do
@moduledoc false
@topic "elixirtest"
@partition 0
# this works
def uses_stream_immediately_takes_two do
KafkaEx.stream(@topic, @partition, offset: 0)
|> Stream.map(& "the value: " <> &1.value)
|> Enum.take(2)
end
# using to_list instead of take causes the method to never return:
def uses_stream_immediately_takes_all do
KafkaEx.stream(@topic, @partition, offset: 0)
|> Stream.map(& "the value: " <> &1.value)
|> Enum.to_list
end
# not using the stream immediately causes the method to never return, too:
def waits_before_using_the_stream_takes_two do
theStream = KafkaEx.stream(@topic, @partition, offset: 0)
:timer.sleep(1000) # waiting a bit..
theStream
|> Stream.map(& "the value: " <> &1.value)
|> Enum.take(2)
end
end
Metadata
Metadata
Assignees
Labels
No labels