Current section

113 Versions

Jump to

Compare versions

8 files changed
+63 additions
-34 deletions
  @@ -19,7 +19,7 @@ clean:
19 19 @rm -rf ebin deps doc
20 20 @rm -f pipe.testdata
21 21
22 - hex-publish:
22 + hex-publish: clean
23 23 @rebar3 hex publish
24 24 @rebar3 hex docs
  @@ -189,8 +189,8 @@ All messages are unified into a batch format of below spec:
189 189 ```erlang
190 190 brod:produce_sync(_Client = brod_client_1,
191 191 _Topic = <<"brod-test-topic-1">>,
192 - _Partition = 0
193 - _Key = <<"some-key">>
192 + _Partition = 0,
193 + _Key = <<"some-key">>,
194 194 _Value = <<"some-value">>).
195 195 ```
196 196
  @@ -200,8 +200,8 @@ Or block calling process until Kafka confirmed the message:
200 200 {ok, CallRef} =
201 201 brod:produce(_Client = brod_client_1,
202 202 _Topic = <<"brod-test-topic-1">>,
203 - _Partition = 0
204 - _Key = <<"some-key">>
203 + _Partition = 0,
204 + _Key = <<"some-key">>,
205 205 _Value = <<"some-value">>),
206 206 brod:sync_produce_request(CallRef).
207 207 ```
  @@ -230,10 +230,10 @@ ok = brod:produce_sync(Client, Topic, PartitionFun, Key, Value).
230 230 ```erlang
231 231 brod:produce(_Client = brod_client_1,
232 232 _Topic = <<"brod-test-topic-1">>,
233 - _Partition = MyPartitionerFun
234 - _Key = KeyUsedForPartitioning
235 - _Value = [ #{key => "k1" value => "v1", headers = [{"foo", "bar"}]}
236 - , #{key => "k2" value => "v2"}
233 + _Partition = MyPartitionerFun,
234 + _Key = KeyUsedForPartitioning,
235 + _Value = [ #{key => "k1", value => "v1", headers => [{"foo", "bar"}]}
236 + , #{key => "k2", value => "v2"}
237 237 ]).
238 238 ```
239 239
  @@ -284,7 +284,7 @@ In brod, we have so far implemented two different subscribers
284 284 (`brod_topic_subscriber` and `brod_group_subscriber`),
285 285 hopefully covered most of the common use cases.
286 286
287 - For maximum flexibility, an applications may implement their own
287 + For maximum flexibility, applications may implement their own
288 288 per-partition subscriber.
289 289
290 290 Below diagrams illustrate 3 examples of how subscriber processes may work
  @@ -398,7 +398,7 @@ See also: https://github.com/klarna/brod/wiki/SASL-gssapi-(kerberos)-authenticat
398 398
399 399 # Other API to play with/inspect kafka
400 400
401 - These functions open a connetion to kafka cluster, send a request,
401 + These functions open a connection to kafka cluster, send a request,
402 402 await response and then close the connection.
403 403
404 404 ```erlang
  @@ -408,18 +408,19 @@ Partition = 0.
408 408 Timeout = 1000.
409 409 TopicConfigs = [
410 410 #{
411 - config_entries => [],
411 + config_entries => [ #{ config_name => <<"cleanup.policy">>
412 + , config_value => "compact"}],
412 413 num_partitions => 1,
413 414 replica_assignment => [],
414 415 replication_factor => 1,
415 416 topic => Topic
416 417 }
417 - ]
418 + ].
418 419 brod:get_metadata(Hosts).
419 420 brod:create_topics(Hosts, TopicConfigs, #{timeout => Timeout}).
420 421 brod:get_metadata(Hosts, [Topic]).
421 - brod:delete_topics(Hosts, [Topic], Timeout).
422 422 brod:resolve_offset(Hosts, Topic, Partition).
423 + brod:delete_topics(Hosts, [Topic], Timeout).
423 424 ```
424 425
425 426 Caution the above delete_topics can fail if you do not have `delete.topic.enable` set to true in your kafka config
  @@ -435,7 +436,7 @@ _build/brod_cli/rel/brod/bin/brod -h
435 436
436 437 Disclaimer: This script is NOT designed for use cases where fault-tolerance is a hard requirement.
437 438 As it may crash when e.g. kafka cluster is temporarily unreachable,
438 - or (for fetch command) when the parition leader migrates to another broker in the cluster.
439 + or (for fetch command) when the partition leader migrates to another broker in the cluster.
439 440
440 441 ## brod-cli examples (with `alias brod=_build/brod_cli/rel/brod/bin/brod`):
  @@ -2,9 +2,9 @@
2 2 {<<"build_tools">>,[<<"rebar3">>]}.
3 3 {<<"description">>,<<"Apache Kafka Erlang client library">>}.
4 4 {<<"files">>,
5 - [<<"src/brod.app.src">>,<<"LICENSE">>,<<"Makefile">>,<<"NOTICE">>,
6 - <<"README.md">>,<<"include/brod.hrl">>,<<"include/brod_int.hrl">>,
7 - <<"rebar.config">>,<<"rebar.config.script">>,<<"src/brod.erl">>,
5 + [<<"LICENSE">>,<<"Makefile">>,<<"NOTICE">>,<<"README.md">>,
6 + <<"include/brod.hrl">>,<<"include/brod_int.hrl">>,<<"rebar.config">>,
7 + <<"rebar.config.script">>,<<"src/brod.app.src">>,<<"src/brod.erl">>,
8 8 <<"src/brod_cg_commits.erl">>,<<"src/brod_cli.erl">>,
9 9 <<"src/brod_cli_pipe.erl">>,<<"src/brod_client.erl">>,
10 10 <<"src/brod_consumer.erl">>,<<"src/brod_consumers_sup.erl">>,
  @@ -26,5 +26,5 @@
26 26 {<<"supervisor3">>,
27 27 [{<<"app">>,<<"supervisor3">>},
28 28 {<<"optional">>,false},
29 - {<<"requirement">>,<<"1.1.8">>}]}]}.
30 - {<<"version">>,<<"3.12.0">>}.
29 + {<<"requirement">>,<<"1.1.11">>}]}]}.
30 + {<<"version">>,<<"3.13.0">>}.
  @@ -1,4 +1,4 @@
1 - {deps, [ {supervisor3, "1.1.8"}
1 + {deps, [ {supervisor3, "1.1.11"}
2 2 , {kafka_protocol, "2.3.6"}
3 3 ]}.
4 4 {edoc_opts, [{preprocess, true}, {macros, [{build_brod_cli, true}]}]}.
  @@ -2,7 +2,7 @@ IsRebar3 = erlang:function_exported(rebar3, main, 1),
2 2 DocoptUrl = "https://github.com/zmstone/docopt-erl.git",
3 3 DocOptTag = "0.1.3",
4 4 DocoptDep = {docopt, {git, DocoptUrl, {branch, DocOptTag}}},
5 - Snabbkaffe = {snabbkaffe, "0.3.3"},
5 + Snabbkaffe = {snabbkaffe, {git, "https://github.com/klarna/snabbkaffe", {tag, "0.5.0"}}},
6 6 Profiles =
7 7 {profiles, [
8 8 {brod_cli, [
  @@ -13,7 +13,7 @@ Profiles =
13 13 [brod, jsone, docopt]},
14 14 {include_erts, true},
15 15 {overlay, [{copy, "scripts/brod", "bin"},
16 - {copy, "{{lib_dirs}}/crc32cer/priv/crc32cer.so", "bin"},
16 + {copy, "{{lib_dirs}}/crc32cer/priv/crc32cer*.so", "bin"},
17 17 {copy, "{{lib_dirs}}/snappyer/priv/snappyer.so", "bin"}
18 18 ]}
19 19 ]}]},
Loading more files…