1
卡夫卡和zookeeper工作正常,因爲我已經嘗試了用於產生或消費消息的JAVA的基本方法,所以這裏的問題是,我正在考慮在項目中使用Spring集成卡夫卡和XML文件是這樣的:春季集成卡夫卡XML參數錯誤
<int:channel id="inputToKafka">
<int:queue/>
</int:channel>
<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-codec="default"/>
</int-kafka:producer-configurations>
</int-kafka:producer-context>
控制檯表明:
Line 43 in XML document from file [/Users/zhanghui/Downloads/work/SVN/DBNService/web/WEB-INF/classes/config/spring/applicationContext-kafka.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 43; columnNumber: 35; cvc-complex-type.3.2.2: element 'int-kafka:producer-configuration' is not allowed to have the argument 'compression-codec'。
那麼誰知道我應該如何設置的值,以避免這種情況?