我使用camel从kafka读取事件,但是当kafka代理出现连接错误时,camel不会抛出任何异常。它唯一能做的就是记录一个警告,说它无法连接到Kafka。
问题是,我想为我的etl创建一个健康检查,如果kafka代理突然崩溃,我将永远不会知道,因为会抛出任何异常。
有人知道是否有可能改变这种行为吗?
我只有这些日志:
{“@timestamp”:“2020-10-06t17:31:05.202+01:00”,“@version”:“1”,“message”:“[consumer clientid=consumer-beam\u etl\u events3-1,groupid=beam\u etl\u events3]初始化到节点的连接localhost:9092 (id:-1 rack:null)用于发送元数据请求,“logger\u name”:“org.apache.kafka.clients.networkclient”,“threadŠname”:“camel(camel-1)threadŠ1-kafkaconsumer[beamŠevents],“level”:“debug”,“levelŠvalue”:10000}
{“@timestamp”:“2020-10-06t17:31:05.203+01:00”,“@version”:“1”,“message”:“[consumer clientid=consumer-beam\u etl\u events3-1,groupid=beam\u etl\u events3]启动到节点的连接localhost:9092 (id:-1 rack:null)使用地址localhost/127.0.0.1,“logger\u name”:“org.apache.kafka.clients.networkclient”,“threadŠname”:“camel(camel-1)threadŠ1-kafkaconsumer[beamŠevents],“level”:“debug”,“levelŠvalue”:10000}
{“@timestamp”:“2020-10-06t17:31:05.205+01:00”,“@version”:“1”,“message”:“[consumer clientid=consumer-beamŠetlŠevents3-1,groupid=beamŠetlŠevents3]与localhost/127.0.0.1的连接已断开”,“loggerŠname”:“org.apache.kafka.common.network.selector”,“threadŠname”:“camel(camel-1)threadŠ1-kafkaconsumer[beamŠevents]”,“level,“level\u value”:10000,“stack\u trace”:“java.net.connectexception:conexão recusada \n \tat sun.nio.ch.socketchannelimpl.checkconnect(本机方法)\n \tat sun.nio.ch.socketchannelimpl.finishconnect(socketchannelimpl)。java:714)\n\tat org.apache.kafka.common.network.plaintexttransportlayer.finishconnect(plaintexttransportlayer)。java:50)\否\torg.apache.kafka.common.network.kafkachannel.finishconnect(Kafka通道)。java:219)\n\t org.apache.kafka.common.network.selector.pollselectionkeys(选择器。java:530)\n\t org.apache.kafka.common.network.selector.poll(selector。java:485)\n\t org.apache.kafka.clients.networkclient.poll(networkclient。java:550)\否\torg.apache.kafka.clients.consumer.internals.consumernetworkclient.poll(consumernetworkclient。java:262)\n\t org.apache.kafka.clients.consumer.internals.consumernetworkclient.poll(consumernetworkclient。java:233)\n\t org.apache.kafka.clients.consumer.internals.consumernetworkclient.poll(consumernetworkclient。java:224)\否\torg.apache.kafka.clients.consumer.internals.consumernetworkclient.awaitmetadataupdate(consumernetworkclient)。java:161)\n\t org.apache.kafka.clients.consumer.internals.abstractcoordinator.ensurecoordinatorready(abstractcoordinator。java:246)\否\torg.apache.kafka.clients.consumer.internals.consumercoordinator.poll(consumercoordinator。java:469)\n\t org.apache.kafka.clients.consumer.kafkaconsumer.updateassignmentmetadataifneeded(kafkaconsumer。java:1274)\n\t org.apache.kafka.clients.consumer.kafkaconsumer.poll(kafkaconsumer。java:1238)\否\torg.apache.kafka.clients.consumer.kafkaconsumer.poll(kafkaconsumer。java:1173)\n\t org.apache.camel.component.kafka.kafkaconsumer$kafkafetchrecords.dorun(kafkaconsumer。java:312)\n\t org.apache.camel.component.kafka.kafkaconsumer$kafkafetchrecords.run(kafkaconsumer。java:222)\否\tjava.util.concurrent.executors$runnableadapter.call(executors。java:511)\n\t java.util.concurrent.futuretask.run$$$capture(futuretask。java:266)\n\tat java.util.concurrent.futuretask.run(futuretask.java)\n\tat java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor)。java:1149)\否\tjava.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor。java:624)\n\t java.lang.thread.run(线程。java:748)\n“}
{“@timestamp”:“2020-10-06t17:31:05.207+01:00”,“@version”:“1”,“message”:“[consumer clientid=consumer-beamŠetlŠevents3-1,groupid=beamŠetlŠevents3]node-1 disconnected.”,“loggerŠname”:“org.apache.kafka.clients.networkclient”,“threadŠname”:“camel(camel-1)threadŠ1-kafkaconsumer[beamŠevents]”,“level”:“debug”,“level
{“@timestamp”:“2020-10-06t17:31:05.207+01:00”,“@version”:“1”,“message”:“[consumer clientid=consumer-beam\u etl\u events3-1,groupid=beam\u etl\u events3]无法建立到节点-1(localhost/127.0.0.1:9092)的连接。代理可能不可用。“,”loggerŠu name“:”org.apache.kafka.clients.networkclient“,”threadŠname“:”camel(camel-1)threadŠ1-kafkaconsumer[beamŠevents],”level“:”warn“,”levelŠvalue“:30000}
{“@timestamp”:“2020-10-06t17:31:05.208+01:00”,“@version”:“1”,“message”:“[consumer clientid=consumer-beam\u etl\u events3-1,groupid=beam\u etl\u events3]引导代理程序localhost:9092 (id:-1 rack:null)disconnected“,”loggerŠu name“:”org.apache.kafka.clients.networkclient“,”threadŠname“:”camel(camel-1)threadŠ1-kafkaconsumer[beamŠevents]“,“level”:“警告”,“level\u值”:30000}
{“@timestamp”:“2020-10-06t17:31:05.308+01:00”,“@version”:“1”,“message”:“[consumer clientid=consumer-beam\u etl\u events3-1,groupid=beam\u etl\u events3]放弃发送元数据请求,因为没有可用的节点”,“logger\u name”:“org”
暂无答案!
目前还没有任何答案,快来回答吧!