Example usage for org.springframework.kafka.listener.adapter MessagingMessageListenerAdapter setReplyTopic

List of usage examples for org.springframework.kafka.listener.adapter MessagingMessageListenerAdapter setReplyTopic

Introduction

In this page you can find the example usage for org.springframework.kafka.listener.adapter MessagingMessageListenerAdapter setReplyTopic.

Prototype

public void setReplyTopic(String replyTopicParam) 

Source Link

Document

Set the topic to which to send any result from the method invocation.

Usage

From source file:org.springframework.kafka.config.MethodKafkaListenerEndpoint.java

@Override
protected MessagingMessageListenerAdapter<K, V> createMessageListener(MessageListenerContainer container,
        MessageConverter messageConverter) {
    Assert.state(this.messageHandlerMethodFactory != null,
            "Could not create message listener - MessageHandlerMethodFactory not set");
    MessagingMessageListenerAdapter<K, V> messageListener = createMessageListenerInstance(messageConverter);
    messageListener.setHandlerMethod(configureListenerAdapter(messageListener));
    String replyTopic = getReplyTopic();
    if (replyTopic != null) {
        Assert.state(getMethod().getReturnType().equals(void.class) || getReplyTemplate() != null,
                "a KafkaTemplate is required to support replies");
        messageListener.setReplyTopic(replyTopic);
    }// w  w  w.  java2s  . c  o  m
    if (getReplyTemplate() != null) {
        messageListener.setReplyTemplate(getReplyTemplate());
    }
    return messageListener;
}