You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GH-3616: Defer default topic resolution to the ReplyingKafkaTemplate
Fixes: #3616
Issue link: #3616
The `KafkaProducerMessageHandler` uses an unnecessary logic to determine a default topic/partition.
It is better to push such a logic down to the `ReplyingKafkaTemplate` as more general solution
* Remove `KafkaProducerMessageHandler.getReplyTopic()` logic altogether
* Clean up tests for removed logic
* Add `exclude group: 'ch.qos.logback'` to be able to control logging for SI-Kafka module
* Remove out-dated sentence from `kafka.adoc`
Copy file name to clipboardExpand all lines: spring-integration-kafka/src/main/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandler.java
Copy file name to clipboardExpand all lines: spring-integration-kafka/src/test/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandlerTests.java
+6-31Lines changed: 6 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -121,17 +121,17 @@
121
121
*/
122
122
classKafkaProducerMessageHandlerTests {
123
123
124
-
privatestaticStringtopic1 = "testTopic1out";
124
+
privatestaticfinalStringtopic1 = "testTopic1out";
125
125
126
-
privatestaticStringtopic2 = "testTopic2out";
126
+
privatestaticfinalStringtopic2 = "testTopic2out";
127
127
128
-
privatestaticStringtopic3 = "testTopic3out";
128
+
privatestaticfinalStringtopic3 = "testTopic3out";
129
129
130
-
privatestaticStringtopic4 = "testTopic4out";
130
+
privatestaticfinalStringtopic4 = "testTopic4out";
131
131
132
-
privatestaticStringtopic5 = "testTopic5out";
132
+
privatestaticfinalStringtopic5 = "testTopic5out";
133
133
134
-
privatestaticStringtopic6 = "testTopic6in";
134
+
privatestaticfinalStringtopic6 = "testTopic6in";
135
135
136
136
privatestaticEmbeddedKafkaBrokerembeddedKafka;
137
137
@@ -467,31 +467,6 @@ public void onPartitionsAssigned(Collection<TopicPartition> partitions) {
Copy file name to clipboardExpand all lines: src/reference/antora/modules/ROOT/pages/kafka.adoc
-3Lines changed: 0 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -468,9 +468,6 @@ The outbound gateway is for request/reply operations.
468
468
It differs from most Spring Integration gateways in that the sending thread does not block in the gateway, and the reply is processed on the reply listener container thread.
469
469
If your code invokes the gateway behind a synchronous https://docs.spring.io/spring-integration/reference/html/messaging-endpoints-chapter.html#gateway[Messaging Gateway], the user thread blocks there until the reply is received (or a timeout occurs).
470
470
471
-
IMPORTANT: The gateway does not accept requests until the reply container has been assigned its topics and partitions.
472
-
It is suggested that you add a `ConsumerRebalanceListener` to the template's reply container properties and wait for the `onPartitionsAssigned` call before sending messages to the gateway.
473
-
474
471
The `KafkaProducerMessageHandler` `sendTimeoutExpression` default is `delivery.timeout.ms` Kafka producer property `+ 5000` so that the actual Kafka error after a timeout is propagated to the application, instead of a timeout generated by this framework.
475
472
This has been changed for consistency because you may get unexpected behavior (Spring may time out the `send()`, while it is actually, eventually, successful).
476
473
IMPORTANT: That timeout is 120 seconds by default, so you may wish to reduce it to get more timely failures.
0 commit comments