|
21 | 21 | import java.util.Collection; |
22 | 22 | import java.util.regex.Pattern; |
23 | 23 |
|
| 24 | +import org.apache.commons.logging.Log; |
| 25 | +import org.apache.commons.logging.LogFactory; |
| 26 | + |
24 | 27 | import org.springframework.beans.BeanUtils; |
25 | 28 | import org.springframework.beans.factory.InitializingBean; |
26 | 29 | import org.springframework.context.ApplicationEventPublisher; |
|
35 | 38 | import org.springframework.kafka.listener.GenericErrorHandler; |
36 | 39 | import org.springframework.kafka.listener.adapter.RecordFilterStrategy; |
37 | 40 | import org.springframework.kafka.listener.adapter.ReplyHeadersConfigurer; |
| 41 | +import org.springframework.kafka.requestreply.ReplyingKafkaOperations; |
38 | 42 | import org.springframework.kafka.support.TopicPartitionInitialOffset; |
39 | 43 | import org.springframework.kafka.support.converter.MessageConverter; |
40 | 44 | import org.springframework.retry.RecoveryCallback; |
|
57 | 61 | public abstract class AbstractKafkaListenerContainerFactory<C extends AbstractMessageListenerContainer<K, V>, K, V> |
58 | 62 | implements KafkaListenerContainerFactory<C>, ApplicationEventPublisherAware, InitializingBean { |
59 | 63 |
|
| 64 | + protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR protected |
| 65 | + |
60 | 66 | private final ContainerProperties containerProperties = new ContainerProperties((Pattern) null); |
61 | 67 |
|
62 | 68 | private GenericErrorHandler<?> errorHandler; |
@@ -203,6 +209,13 @@ public void setApplicationEventPublisher(ApplicationEventPublisher applicationEv |
203 | 209 | * @since 2.0 |
204 | 210 | */ |
205 | 211 | public void setReplyTemplate(KafkaTemplate<?, ?> replyTemplate) { |
| 212 | + if (replyTemplate instanceof ReplyingKafkaOperations) { |
| 213 | + this.logger.warn( |
| 214 | + "The 'replyTemplate' should not be an implementation of 'ReplyingKafkaOperations'; " |
| 215 | + + "such implementations are for client-side request/reply operations; here we " |
| 216 | + + "are simply sending a reply to an incoming request so the reply container will " |
| 217 | + + "never be used and will consume unnecessary resources."); |
| 218 | + } |
206 | 219 | this.replyTemplate = replyTemplate; |
207 | 220 | } |
208 | 221 |
|
|
0 commit comments