Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ public void setBatchToRecordAdapter(BatchToRecordAdapter<K, V> batchToRecordAdap
* properly propagated to the batch converter's record converter for message conversion
* in batch listeners.
* <p>
* Uses the same validation as the parent class to prevent the paradox of choice:
* not allowed when a custom {@link #setBatchMessageConverter(BatchMessageConverter)
* batchMessageConverter} is provided. Since {@link BatchMessagingMessageConverter} now
* This method cannot be called after {@link #setBatchMessageConverter(BatchMessageConverter)
* setBatchMessageConverter()} as it would cause a mutation of the internal
* batchMessageConverter. Instead, the SmartMessageConverter has to be provided on the
* external BatchMessageConverter. Since {@link BatchMessagingMessageConverter} now
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, revise this Javadoc for code snippets.
I believe that setBatchMessageConverter() link is a bit off.
The batchMessageConverter as to be link, as well as SmartMessageConverter and BatchMessageConverter.

* always has a default {@link org.springframework.kafka.support.converter.MessagingMessageConverter},
* users can configure the converter via the annotation without needing to set it on the factory.
* @param messageConverter the converter to set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public RecordMessageConverter getRecordMessageConverter() {
}

/**
* Set a spring-messaging {@link SmartMessageConverter} to convert the record value to
* Set a {@link SmartMessageConverter} to convert the record value to
* the desired type.
* @param messagingConverter the converter.
* @since 3.3.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@

/**
* Integration tests for SmartMessageConverter support in batch listeners.
* Reproduces and verifies the fix for the issue described in GH-4097.
*
* @author George Mahfoud
* @since 3.3.11
Expand All @@ -80,7 +79,7 @@ void testContentTypeConverterWithBatchListener() throws Exception {
this.template.send("smartBatchTopic", "world".getBytes());

assertThat(listener.latch.await(10, TimeUnit.SECONDS)).isTrue();
assertThat(listener.received).hasSize(2).containsExactly("hello", "world");
assertThat(listener.received).containsExactly("hello", "world");
}

@Test
Expand All @@ -90,13 +89,15 @@ void testMultipleListenersWithDifferentConverters() throws Exception {
listener1.reset(1);
listener2.reset(1);

this.template.send("smartBatchTopic", "foo".getBytes());
this.template.send("smartBatchTopic2", "bar".getBytes());
String listener1Data = "listener1Data";
String listener2Data = "listener2Data";
this.template.send("smartBatchTopic", listener1Data.getBytes());
this.template.send("smartBatchTopic2", listener2Data.getBytes());

assertThat(listener1.latch.await(10, TimeUnit.SECONDS)).isTrue();
assertThat(listener2.latch.await(10, TimeUnit.SECONDS)).isTrue();
assertThat(listener1.received).hasSize(1).containsExactly("foo");
assertThat(listener2.received).hasSize(1).containsExactly("BAR");
assertThat(listener1.received).containsExactly(listener1Data);
assertThat(listener2.received).containsExactly(listener2Data.toUpperCase());
}

@Configuration
Expand Down