You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Walter rakoff <wa...@gmail.com> on 2016/05/24 21:28:11 UTC
Kafka Streams error
Hello,
I'm trying a sample Kafka Streams program in Scala.
val clickRecordKStream: KStream[String, ClickRecord] =
kStreamBuilder.stream(stringSerde, stringSerde, "test-topic")
.map( (k:String, v:String) => (k, ClickRecord(v)))
The map call throws error "type mismatch; found : (String, String) =>
(String, ClickRecord) required:
org.apache.kafka.streams.kstream.KeyValueMapper[String,String,org.apache.kafka.streams.KeyValue[?,?]]
A similar example [1] has a comment " Requires a version of Scala that
supports Java 8 and SAM / Java lambda (e.g. Scala 2.11
with `-Xexperimental` compiler flag, or 2.12)"
Is there any way to get this working on Scala 2.10? Everything we write is
built in 2.10.
If not, what are the downside of `-Xexperimental` flag in 2.11?
[1]
https://github.com/confluentinc/examples/blob/master/kafka-streams/src/main/scala/io/confluent/examples/streams/MapFunctionScalaExample.scala
Thanks,
Walter
Re: Kafka Streams error
Posted by Guozhang Wang <wa...@gmail.com>.
Hi Walter,
Synced up with Ismael regarding your questions, and here are our
suggestions:
"Scala 2.11 is the minimum. The downside of that flag is that it includes
new features that are still changing, may be less stable and may not work
fully.
You may probably consider planning an upgrade as support for 2.10 will
start to be dropped by various projects once 2.12 is released later this
year."
Guozhang
On Tue, May 24, 2016 at 2:28 PM, Walter rakoff <wa...@gmail.com>
wrote:
> Hello,
>
> I'm trying a sample Kafka Streams program in Scala.
>
> val clickRecordKStream: KStream[String, ClickRecord] =
> kStreamBuilder.stream(stringSerde, stringSerde, "test-topic")
> .map( (k:String, v:String) => (k, ClickRecord(v)))
>
> The map call throws error "type mismatch; found : (String, String) =>
> (String, ClickRecord) required:
>
> org.apache.kafka.streams.kstream.KeyValueMapper[String,String,org.apache.kafka.streams.KeyValue[?,?]]
>
> A similar example [1] has a comment " Requires a version of Scala that
> supports Java 8 and SAM / Java lambda (e.g. Scala 2.11
> with `-Xexperimental` compiler flag, or 2.12)"
> Is there any way to get this working on Scala 2.10? Everything we write is
> built in 2.10.
> If not, what are the downside of `-Xexperimental` flag in 2.11?
>
> [1]
>
> https://github.com/confluentinc/examples/blob/master/kafka-streams/src/main/scala/io/confluent/examples/streams/MapFunctionScalaExample.scala
>
> Thanks,
> Walter
>
--
-- Guozhang