Skip to content

Commit 5e732ed

Browse files
committed
Document message callback runs in dedicated thread
References #298
1 parent baa38b3 commit 5e732ed

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/docs/asciidoc/api.adoc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -781,13 +781,12 @@ include::{test-examples}/ConsumerUsage.java[tag=producer-creation]
781781
The broker start sending messages as soon as the `Consumer` instance is created.
782782

783783
[WARNING]
784-
.Keep the message processing callback as short as possible
784+
.The message processing callback can take its time, but not too much
785785
====
786-
The message processing callback should be kept as short as possible
787-
to avoid blocking the connection thread. Not doing so can
788-
make the `Environment`, `Producer`, `Consumer` instances sluggish
789-
or even block them. Any long processing should be done in
790-
a separate thread (e.g. with an asynchronous `ExecutorService`).
786+
The message processing callback should not take too long or it could impact other consumers sharing the same connection.
787+
The <<configuring-the-environment,`EnvironmentBuilder#maxConsumersByConnection(int)>>` method allows isolating consumers from each other, at the cost of creating and maintaining more connections.
788+
Consider using a separate thread for long processing (e.g. with an asynchronous `ExecutorService`).
789+
Note message processing callbacks run in a dedicated thread, they do not impact other network frames, which run in their own thread.
791790
====
792791

793792
The following table sums up the main settings to create a `Consumer`:
@@ -1207,4 +1206,4 @@ include::{test-examples}/ConsumerUsage.java[tag=sac-consumer-update-listener]
12071206
<3> Disable server-side offset tracking
12081207
<4> Set the consumer update listener
12091208
<5> Fetch last offset from external store
1210-
<6> Return the offset to resume consuming from to the broker
1209+
<6> Return the offset to resume consuming from to the broker

0 commit comments

Comments
 (0)