Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.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
Apache kafka 值已在kafka streams的作用域中定义_Apache Kafka_Apache Kafka Streams - Fatal编程技术网

Apache kafka 值已在kafka streams的作用域中定义

Apache kafka 值已在kafka streams的作用域中定义,apache-kafka,apache-kafka-streams,Apache Kafka,Apache Kafka Streams,我在尝试卡夫卡流中的编码部分,如下所示 KStreamBuilder builder = new KStreamBuilder(); KStream<String, String> textlines = builder.stream("iostatin2"); KStream<String, String> mstream = textlines .mapValues(value -> value.replace("[","" )

我在尝试卡夫卡流中的编码部分,如下所示

KStreamBuilder builder = new KStreamBuilder();
KStream<String, String> textlines = builder.stream("iostatin2");
KStream<String, String> mstream = textlines
                .mapValues(value -> value.replace("[","" ) )
                .mapValues(value -> value.replace("]","" ) )
                .mapValues(value -> value.replaceAll("\":\"", "\":"))
                .mapValues(value -> value.replaceAll("\":", "\":\""))
                .mapValues(value -> value.replaceAll("\",\"", ",\""))
                .mapValues(value -> value.replaceAll(",\"", "\",\""))
                .mapValues(value -> value.replaceAll(":\"\\{", ":\\{"))
                .mapValues(value -> value.replaceAll("\\}\",", "\\},"))
                .mapValues(value -> value.replaceAll("\\},\\{" ,"\\}\\},\\{\\{"));

        textlines.foreach(new ForeachAction<String, String>() {
                     @Override
                     public void apply(String key, String value) {
                         try {
                             textlines.flatMapValues(value -> Arrays.asList(value.split("\\},\\{")));

                             Thread.sleep(2000);
                         } catch (InterruptedException e) {
                             e.printStackTrace();
                         }

                     }
                 });

在此行中,值导致了一个错误,例如变量“value”已在范围中定义。那么我应该用…plzz help me out…替换该行什么呢?

值已在上面的apply()方法中用作参数, 因此,请更改行中的值
textlines.flatMapValues(value->array.asList(value.split(\\},\\{”);

任何其他名字,比如v


textlines.flatMapValues(v->array.asList(v.split(\\},\\{”);

是否重命名变量?
textlines.flatMapValues(value -> Arrays.asList(value.split("\\},\\{")));