2016-10-10 83 views
0

使用int-kafka:出站通道適配器生成kafka時,似乎沒有可用的錯誤通道。在這種情況下,如何處理消息在reties時間後未能生成kafka?春季集成kafka如何處理生成kafka時的錯誤

任何可能導致卡夫卡故障的錯誤。 (下面的代碼只是代碼片斷互聯網,只是不知道如何處理錯誤給它添加)

<int-kafka:outbound-channel-adapter id="kafkaOutboundChannelAdapter" 
            kafka-producer-context-ref="kafkaProducerContext" 
            auto-startup="true" 
            channel="inputToKafka" 
            topic="test"> 
    <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"/> 

<int-kafka:producer-context id="kafkaProducerContext" producer-properties="producerProps"> 
    <int-kafka:producer-configurations> 
     <int-kafka:producer-configuration broker-list="XXXXXX:6667" 
        key-class-type="java.lang.String" 
        value-class-type="java.lang.String" 
        topic="rating" 
        value-serializer="kafkaSerializer" 
        key-serializer="kafkaSerializer" 
        compression-type="none"/> 
    </int-kafka:producer-configurations> 
</int-kafka:producer-context> 


<util:properties id="producerProps"> 
    <prop key="queue.buffering.max.ms">500</prop> 
    <prop key="topic.metadata.refresh.interval.ms">3600000</prop> 
    <prop key="queue.buffering.max.messages">10000</prop> 
    <prop key="retry.backoff.ms">100</prop> 
    <prop key="message.send.max.retries">2</prop> 
    <prop key="send.buffer.bytes">5242880</prop> 
    <prop key="socket.request.max.bytes">104857600</prop> 
    <prop key="socket.receive.buffer.bytes">1048576</prop> 
    <prop key="socket.send.buffer.bytes">1048576</prop> 
    <prop key="request.required.acks">1</prop> 
</util:properties> 

回答