klarna-incubator / kflow Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Hello!
I setup a minimal kflow
server using this kflow_config
module:
-module(kflow_config).
-export([pipes/0]).
pipes() ->
[bar()].
bar() ->
PipeSpec = [{map, fun(_Offset, Msg) ->
io:format("~p ~p:~p bar Msg: '~p'~n", [calendar:local_time(), ?MODULE, ?LINE, Msg]),
{ok, Msg}
end},
{map, fun(_Offset, Msg2) ->
io:format("~p ~p:~p Msg2: '~p'~n", [calendar:local_time(), ?MODULE, ?LINE, Msg2]),
{ok, Msg2}
end}
],
#{ start => {kflow_kafka_consumer_v2, start_link}
, args => #{ group_id => <<"foo_group">>
, topics => [<<"foobar">>]
, id => ?FUNCTION_NAME
, pipe_spec => PipeSpec
, auto_commit => false
}
}.
First I create a topic with two partitions:
kafka-topics --create --topic foobar --partitions 2 -replication-factor 1 --bootstrap-server localhost:9091
Then produce some messages using brod:
brod:produce_sync(brod_client_1, <<"foobar">>, 1, <<"">>, <<"test1 from brod">>).
brod:produce_sync(brod_client_1, <<"foobar">>, 0, <<"">>, <<"test0 from brod">>).
The messages are printed on the kflow
side:
{{2021,1,20},{18,5,50}} kflow_config:44 bar Msg: '#{headers => [],key => <<>>,
partition => 1,
value =>
<<"test1 from brod">>}'
{{2021,1,20},{18,5,50}} kflow_config:50 Msg2: '{ok,
#{headers => [],key => <<>>,
partition => 1,
value =>
<<"test1 from brod">>}}'
{{2021,1,20},{18,5,59}} kflow_config:44 bar Msg: '#{headers => [],key => <<>>,
partition => 0,
value =>
<<"test0 from brod">>}'
{{2021,1,20},{18,5,59}} kflow_config:50 Msg2: '{ok,
#{headers => [],key => <<>>,
partition => 0,
value =>
<<"test0 from brod">>}}'
Everything works great. Then I add a new partition to the topic:
kafka-topics --alter --topic foobar --partitions 3 --bootstrap-server localhost:9091
and try to send a message into this new partition:
brod:produce_sync(brod_client_1, <<"foobar">>, 2, <<"what is it">>, <<"test2 from brod">>).
Unfortunately this message is not received on the kflow
side. Is it supposed to work at all or am I trying something that's not supported (or even doesn't make sense)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.