Packages
brod
2.2.14
4.5.7
4.5.6
4.5.5
4.5.4
4.5.3
4.5.2
4.5.1
4.5.0
4.4.7
4.4.6
4.4.5
4.4.4
4.4.3
4.4.2
4.4.1
4.4.0
4.3.3
4.3.2
4.3.1
4.3.0
4.2.0
4.1.1
4.1.0
4.0.0
3.19.1
3.19.0
3.18.0
3.17.1
3.17.0
3.16.5
3.16.4
3.16.3
3.16.2
3.16.1
3.16.0
3.15.6
3.15.5
3.15.4
3.15.3
3.15.1
3.15.0
3.14.0
3.13.0
3.12.0
3.11.0
3.10.0
3.9.5
3.9.3
3.9.2
3.9.1
3.9.0
3.8.1
3.8.0
3.7.11
3.7.10
3.7.9
3.7.8
3.7.7
3.7.6
3.7.5
3.7.4
3.7.3
3.7.2
3.7.1
3.7.0
3.6.2
3.6.1
3.6.0
3.5.2
3.5.1
3.5.0
3.4.0
3.3.5
3.3.4
3.3.3
3.3.2
3.3.1
3.3.0
3.2.0
3.0.0
2.5.0
2.4.1
2.4.0
2.3.7
2.3.6
2.3.5
2.3.4
2.3.3
2.3.1
2.2.16
2.2.15
2.2.14
2.2.12
2.2.11
2.2.10
2.2.9
2.2.8
2.2.7
2.2.6
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.12
2.1.11
2.1.10
2.1.8
2.1.7
2.1.4
2.1.2
2.0.0
Apache Kafka Erlang client library
Current section
113 Versions
Jump to
Current section
113 Versions
Compare versions
10
files changed
+236
additions
-86
deletions
| @@ -1,6 +1,6 @@ | |
| 1 1 | PROJECT = brod |
| 2 2 | PROJECT_DESCRIPTION = Kafka client library in Erlang |
| 3 | - PROJECT_VERSION = 2.2.12 |
| 3 | + PROJECT_VERSION = 2.2.14 |
| 4 4 | |
| 5 5 | DEPS = supervisor3 kafka_protocol |
| @@ -1,5 +1,5 @@ | |
| 1 1 | {<<"name">>,<<"brod">>}. |
| 2 | - {<<"version">>,<<"2.2.12">>}. |
| 2 | + {<<"version">>,<<"2.2.14">>}. |
| 3 3 | {<<"requirements">>, |
| 4 4 | #{<<"kafka_protocol">> => #{<<"app">> => <<"kafka_protocol">>, |
| 5 5 | <<"optional">> => false, |
| @@ -1,6 +1,6 @@ | |
| 1 1 | {application,brod, |
| 2 2 | [{description,"Apache Kafka Erlang client library"}, |
| 3 | - {vsn,"2.2.12"}, |
| 3 | + {vsn,"2.2.14"}, |
| 4 4 | {registered,[]}, |
| 5 5 | {applications,[kernel,stdlib,ssl,kafka_protocol,supervisor3]}, |
| 6 6 | {env,[]}, |
| @@ -136,8 +136,7 @@ start_client(BootstrapEndpoints) -> | |
| 136 136 | start_client(BootstrapEndpoints, ?BROD_DEFAULT_CLIENT_ID). |
| 137 137 | |
| 138 138 | %% @equiv stat_client(BootstrapEndpoints, ClientId, []) |
| 139 | - -spec start_client([endpoint()], brod_client_id()) -> |
| 140 | - ok | {error, any()}. |
| 139 | + -spec start_client([endpoint()], brod_client_id()) -> ok | {error, any()}. |
| 141 140 | start_client(BootstrapEndpoints, ClientId) -> |
| 142 141 | start_client(BootstrapEndpoints, ClientId, []). |
| 143 142 | |
| @@ -173,9 +172,15 @@ start_client(BootstrapEndpoints, ClientId) -> | |
| 173 172 | %% user is trying to call 'produce' but did not call |
| 174 173 | %% brod:start_producer explicitly. Can be useful for applications |
| 175 174 | %% which don't know beforehand which topics they will be working with. |
| 176 | - %% default_producer_config (optional, default []) |
| 175 | + %% default_producer_config (optional, default=[]) |
| 177 176 | %% Producer configuration to use when auto_start_producers is true. |
| 178 177 | %% @see brod_client:start_producer/3. for more details. |
| 178 | + %% ssl (optional, default=[]) |
| 179 | + %% [{certfile, ...},{keyfiel, ...},{cacertfile, ...}] |
| 180 | + %% connect_timeout (optional, default=5000) |
| 181 | + %% Timeout when trying to connect to one endpoint. |
| 182 | + %% request_timeout (optional, default=120000, constraint: >= 1000) |
| 183 | + %% Timeout when waiting for a response, socket restart when timedout. |
| 179 184 | %% @end |
| 180 185 | -spec start_client([endpoint()], brod_client_id(), client_config()) -> |
| 181 186 | ok | {error, any()}. |
| @@ -77,14 +77,6 @@ | |
| 77 77 | |
| 78 78 | -define(UNKNOWN_TOPIC_CACHE_EXPIRE_SECONDS, 120). |
| 79 79 | |
| 80 | - -define(TRY_CLIENT_ETS_LOOKUP(Expr), |
| 81 | - try |
| 82 | - Expr |
| 83 | - catch |
| 84 | - error : badarg -> |
| 85 | - {error, client_down} |
| 86 | - end). |
| 87 | - |
| 88 80 | -type partition_worker_key() :: ?PRODUCER_KEY(topic(), partition()) |
| 89 81 | | ?CONSUMER_KEY(topic(), partition()). |
| 90 82 | |
| @@ -455,20 +447,22 @@ get_partition_worker(ClientId, Key) when is_atom(ClientId) -> | |
| 455 447 | -spec lookup_partition_worker(client(), ets:tab(), partition_worker_key()) -> |
| 456 448 | {ok, pid()} | { error, get_worker_error()}. |
| 457 449 | lookup_partition_worker(Client, Ets, Key) -> |
| 458 | - ?TRY_CLIENT_ETS_LOOKUP( |
| 459 | - case ets:lookup(Ets, Key) of |
| 460 | - [] -> |
| 461 | - %% not yet registered, 2 possible reasons: |
| 462 | - %% 1. caller is too fast, producers/consumers are starting up |
| 463 | - %% make a synced call all the way down the supervision tree |
| 464 | - %% to the partition producer sup should resolve the race |
| 465 | - %% 2. bad argument, no such worker started, supervisors should know |
| 466 | - find_partition_worker(Client, Key); |
| 467 | - [?PRODUCER(_Topic, _Partition, Pid)] -> |
| 468 | - {ok, Pid}; |
| 469 | - [?CONSUMER(_Topic, _Partition, Pid)] -> |
| 470 | - {ok, Pid} |
| 471 | - end). |
| 450 | + try ets:lookup(Ets, Key) of |
| 451 | + [] -> |
| 452 | + %% not yet registered, 2 possible reasons: |
| 453 | + %% 1. caller is too fast, producers/consumers are starting up |
| 454 | + %% make a synced call all the way down the supervision tree |
| 455 | + %% to the partition producer sup should resolve the race |
| 456 | + %% 2. bad argument, no such worker started, supervisors should know |
| 457 | + find_partition_worker(Client, Key); |
| 458 | + [?PRODUCER(_Topic, _Partition, Pid)] -> |
| 459 | + {ok, Pid}; |
| 460 | + [?CONSUMER(_Topic, _Partition, Pid)] -> |
| 461 | + {ok, Pid} |
| 462 | + catch |
| 463 | + error : badarg -> |
| 464 | + {error, client_down} |
| 465 | + end. |
| 472 466 | |
| 473 467 | -spec find_partition_worker(client(), partition_worker_key()) -> |
| 474 468 | {ok, pid()} | {error, get_worker_error()}. |
| @@ -743,19 +737,21 @@ get_partitions_count(Client, Ets, Topic) -> | |
| 743 737 | {ok, pos_integer()} | {error, any()} | false. |
| 744 738 | lookup_partitions_count_cache(_Ets, ?undef) -> false; |
| 745 739 | lookup_partitions_count_cache(Ets, Topic) -> |
| 746 | - ?TRY_CLIENT_ETS_LOOKUP( |
| 747 | - case ets:lookup(Ets, ?TOPIC_METADATA_KEY(Topic)) of |
| 748 | - [{_, Count, _Ts}] when is_integer(Count) -> |
| 749 | - {ok, Count}; |
| 750 | - [{_, {error, Reason}, Ts}] -> |
| 751 | - case timer:now_diff(os:timestamp(), Ts) =< |
| 752 | - ?UNKNOWN_TOPIC_CACHE_EXPIRE_SECONDS * 1000000 of |
| 753 | - true -> {error, Reason}; |
| 754 | - false -> false |
| 755 | - end; |
| 756 | - [] -> |
| 757 | - false |
| 758 | - end). |
| 740 | + try ets:lookup(Ets, ?TOPIC_METADATA_KEY(Topic)) of |
| 741 | + [{_, Count, _Ts}] when is_integer(Count) -> |
| 742 | + {ok, Count}; |
| 743 | + [{_, {error, Reason}, Ts}] -> |
| 744 | + case timer:now_diff(os:timestamp(), Ts) =< |
| 745 | + ?UNKNOWN_TOPIC_CACHE_EXPIRE_SECONDS * 1000000 of |
| 746 | + true -> {error, Reason}; |
| 747 | + false -> false |
| 748 | + end; |
| 749 | + [] -> |
| 750 | + false |
| 751 | + catch |
| 752 | + error : badarg -> |
| 753 | + {error, client_down} |
| 754 | + end. |
| 759 755 | |
| 760 756 | -spec do_get_partitions_count(kpro_TopicMetadata()) -> |
| 761 757 | {ok, pos_integer()} | {error, any()}. |
Loading more files…