Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc 如何在春季使用定制的卡夫卡客户端?_Spring Mvc_Apache Kafka_Spring Kafka - Fatal编程技术网

Spring mvc 如何在春季使用定制的卡夫卡客户端?

Spring mvc 如何在春季使用定制的卡夫卡客户端?,spring-mvc,apache-kafka,spring-kafka,Spring Mvc,Apache Kafka,Spring Kafka,所以我实现了一个简单的kafka客户端,遵循一本书,我知道如何在main方法中使用它,比如: while(true){ records = consumer.poll(100); //process records in for loop consumer.commit(); } 但我不知道如何在war web应用程序中启动while(true),或者如何在spring kafka中使用我的客户端?您的问题一点也不清楚。每5秒你到底想做什么?你需要什么样的定制?你能解释

所以我实现了一个简单的kafka客户端,遵循一本书,我知道如何在
main
方法中使用它,比如:

while(true){
    records = consumer.poll(100);
    //process records in for loop
    consumer.commit();
}

但我不知道如何在war web应用程序中启动
while(true)
,或者如何在spring kafka中使用我的客户端?

您的问题一点也不清楚。每5秒你到底想做什么?你需要什么样的定制?你能解释清楚你想要做什么吗?很难帮你解决这样一个问题。这里是下面的链接,如果你想用SpringKafka实现一个引导应用程序。