Spring Kafka消费者有时不工作

snvhrwxg  于 2021-06-04  发布在  Kafka
关注(0)|答案(1)|浏览(635)

消费者有时不工作,有时不工作,无法解决问题。

spring boot - 1.5.21.release
kafka client - 0.11.0.0
kafka servers - IBM event stream service on cloud.

应用程序属性:


# Producer

spring.kafka.template.default-topic=distitopic
spring.kafka.producer.client-id=event-streams-kafka
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer

# Consumer

tier2.disti.search.topic=distitopic
spring.kafka.consumer.enable-auto-commit=false
spring.kafka.consumer.group-id=distigroup
spring.kafka.consumer.auto-offset-reset=latest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer

在我的rest控制器中,我有这个方法

@KafkaListener(topics = "${tier2.disti.search.topic}")
public void listen(ConsumerRecord<String, String> cr) throws Exception {

在websphereapplicationserver的系统输出日志中,我经常看到这些消息

[7/8/19 13:17:04:662 GMT] 00000347 SystemOut     O 2019-07-08 13:17:04.662  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 5 could not be established. Broker may not be available.
[7/8/19 13:17:24:246 GMT] 0000033e SystemOut     O 2019-07-08 13:17:24.246  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:19:12:022 GMT] 00000347 SystemOut     O 2019-07-08 13:19:12.022  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 8 could not be established. Broker may not be available.
[7/8/19 13:19:32:630 GMT] 0000033e SystemOut     O 2019-07-08 13:19:32.630  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:21:19:510 GMT] 00000347 SystemOut     O 2019-07-08 13:21:19.510  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 4 could not be established. Broker may not be available.
[7/8/19 13:21:41:014 GMT] 0000033e SystemOut     O 2019-07-08 13:21:41.014  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:23:26:870 GMT] 00000347 SystemOut     O 2019-07-08 13:23:26.870  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 7 could not be established. Broker may not be available.
[7/8/19 13:23:49:526 GMT] 0000033e SystemOut     O 2019-07-08 13:23:49.526  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:25:34:230 GMT] 00000347 SystemOut     O 2019-07-08 13:25:34.230  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 5 could not be established. Broker may not be available.

[7/8/19 13:25:58:038 GMT] 0000033e SystemOut     O 2019-07-08 13:25:58.038  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:27:41:590 GMT] 00000347 SystemOut     O 2019-07-08 13:27:41.590  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 7 could not be established. Broker may not be available.
[7/8/19 13:28:06:550 GMT] 0000033e SystemOut     O 2019-07-08 13:28:06.550  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:29:48:950 GMT] 00000347 SystemOut     O 2019-07-08 13:29:48.950  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 4 could not be established. Broker may not be available.
[7/8/19 13:30:14:934 GMT] 0000033e SystemOut     O 2019-07-08 13:30:14.934  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:32:23:062 GMT] 0000033e SystemOut     O 2019-07-08 13:32:23.062  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:34:31:446 GMT] 0000033e SystemOut     O 2019-07-08 13:34:31.446  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.

[7/8/19 13:36:39:702 GMT] 0000033e SystemOut     O 2019-07-08 13:36:39.702  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:38:47:958 GMT] 0000033e SystemOut     O 2019-07-08 13:38:47.958  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:40:56:086 GMT] 0000033e SystemOut     O 2019-07-08 13:40:56.086  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:41:26:678 GMT] 00000347 SystemOut     O 2019-07-08 13:41:26.678  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 6 could not be established. Broker may not be available.
[7/8/19 13:43:04:342 GMT] 0000033e SystemOut     O 2019-07-08 13:43:04.342  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:45:12:854 GMT] 0000033e SystemOut     O 2019-07-08 13:45:12.854  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.

[7/8/19 13:47:21:110 GMT] 0000033e SystemOut     O 2019-07-08 13:47:21.110  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:48:34:070 GMT] 00000347 SystemOut     O 2019-07-08 13:48:34.070  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 4 could not be established. Broker may not be available.
[7/8/19 13:49:29:622 GMT] 0000033e SystemOut     O 2019-07-08 13:49:29.622  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:50:41:558 GMT] 00000347 SystemOut     O 2019-07-08 13:50:41.558  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 6 could not be established. Broker may not be available.
[7/8/19 13:51:38:006 GMT] 0000033e SystemOut     O 2019-07-08 13:51:38.006  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:52:48:918 GMT] 00000347 SystemOut     O 2019-07-08 13:52:48.918  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 7 could not be established. Broker may not be available.
[7/8/19 13:53:46:518 GMT] 0000033e SystemOut     O 2019-07-08 13:53:46.518  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.

[7/8/19 13:55:55:030 GMT] 0000033e SystemOut     O 2019-07-08 13:55:55.030  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:58:03:670 GMT] 0000033e SystemOut     O 2019-07-08 13:58:03.670  WARN 32021 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-1, groupId=distigroup] Connection to node -5 could not be established. Broker may not be available.
[7/8/19 13:59:56:310 GMT] 00000347 SystemOut     O 2019-07-08 13:59:56.310  WARN 32021 --- [t-streams-kafka] org.apache.kafka.clients.NetworkClient   : [Producer clientId=event-streams-kafka] Connection to node 8 could not be established. Broker may not be available.
nxagd54h

nxagd54h1#

您是在“bootstrap.servers”或fqdn中指定实际的以逗号分隔的主机名吗?当使用fqdn而不是直接使用主机名时,我遇到了类似的问题。

相关问题