Antwnis / kafka-streaming-examples

Examples of kafka-streaming with [spark-streaming] [kafka-streams] [apache-flink]
Apache License 2.0
7 stars 2 forks source link

Compile error for Kafka Streams #1

Open JohnReedLOL opened 8 years ago

JohnReedLOL commented 8 years ago

I was just interested in copying the Kafka Streams folder and running it...

kafka-streaming-examples-master/kafka-streams$ sbt
[info] Loading project definition from /home/johnreed/Documents/Code/kafka-streaming-examples-master/kafka-streams/project
[info] Set current project to spark-streaming (in build file:/home/johnreed/Documents/Code/kafka-streaming-examples-master/kafka-streams/)
> test
[info] Compiling 2 Scala sources to /home/johnreed/Documents/Code/kafka-streaming-examples-master/kafka-streams/target/scala-2.11/classes...
[error] /home/johnreed/Documents/Code/kafka-streaming-examples-master/kafka-streams/src/main/scala/MapFunctionScalaExample.scala:31: missing parameter type for expanded function
[error] The argument types of an anonymous function must be fully known. (SLS 8.5)
[error] Expected type was: org.apache.kafka.streams.kstream.KeyValueMapper[Array[Byte],String,org.apache.kafka.streams.KeyValue[Array[Byte],String]]
[error]       = textLines.map { case (k: Array[Byte], v: String) => (k, v.toUpperCase()) }
[error]                       ^
[error] /home/johnreed/Documents/Code/kafka-streaming-examples-master/kafka-streams/src/main/scala/MapFunctionScalaExample.scala:51: missing parameter type for expanded function
[error] The argument types of an anonymous function must be fully known. (SLS 8.5)
[error] Expected type was: org.apache.kafka.streams.kstream.KeyValueMapper[Array[Byte],String,org.apache.kafka.streams.KeyValue[Array[Byte],String]]
[error]     val uppercasedWithMap: KStream[Array[Byte], String] = textLines.map { case (key: Array[Byte], value: String) => (key, value.toUpperCase()) }
[error]                                                                         ^
[error] /home/johnreed/Documents/Code/kafka-streaming-examples-master/kafka-streams/src/main/scala/MapFunctionScalaExample.scala:58: missing parameter type
[error]     val originalAndUppercased: KStream[String, String] = textLines.map { (key, value) => (value, value.toString.toUpperCase()) }
[error]                                                                           ^
[error] /home/johnreed/Documents/Code/kafka-streaming-examples-master/kafka-streams/src/main/scala/MapFunctionScalaExample.scala:58: missing parameter type
[error]     val originalAndUppercased: KStream[String, String] = textLines.map { (key, value) => (value, value.toString.toUpperCase()) }
[error]                                                                                ^
[error] four errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 3 s, completed Jul 13, 2016 5:04:34 PM
snavien commented 8 years ago

were you ever able to figure this out?

Antwnis commented 8 years ago

Currently not working on this I'd recommend https://github.com/bbejeck/kafka-streams - who will be authoring a book on KAFKA STREAMS

andrewstevenson commented 8 years ago
        <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <version>3.2.1</version>
            <configuration>
                <args>
                    <!--
                       In combination with Scala 2.11, `-Xexperimental` enables SAM
                       for Java 8 lambda support.  Make sure `kafka.scala.version`
                       is set to `2.11`, not `2.10`.
                    -->
                    <arg>-Xexperimental</arg>
                </args>
            </configuration>