【发布时间】:2015-12-19 23:49:25
【问题描述】:
我正在使用 Spring Integration Kafka 1.3.0 版本,但我仍然得到如下异常。那么有什么想法可以解决这个问题吗?
Error creating bean with name
'org.springframework.integration.kafka.outbound.KafkaProducerMessageHandler#0':
Invocation of init method failed;
nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this argument
is required; it must not be null
我的 xml 文件是这样的:
<int-kafka:outbound-channel-adapter id="kafkaOutboundChannelAdapter"
kafka-producer-context-ref="kafkaProducerContext"
auto-startup="false"
channel="inputToKafka"
order="3"
>
<int:poller fixed-delay="1000" time-unit="MILLISECONDS" receive-timeout="0" task-executor="taskExecutor"/>
</int-kafka:outbound-channel-adapter>
<task:executor id="taskExecutor" pool-size="5" keep-alive="120" queue-capacity="500"/>
<bean id="producerProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="topic.metadata.refresh.interval.ms">3600000</prop>
<prop key="message.send.max.retries">5</prop>
<prop key="serializer.class">kafka.serializer.StringEncoder</prop>
<prop key="request.required.acks">1</prop>
</props>
</property>
</bean>
<int-kafka:producer-context id="kafkaProducerContext"
producer-properties="producerProperties">
<int-kafka:producer-configurations>
<int-kafka:producer-configuration broker-list="127.0.0.1:9092"
topic="test"
compression-type="default"/>
</int-kafka:producer-configurations>
</int-kafka:producer-context>
【问题讨论】: