I am trying to create an instance of the Kafka Scala class from Java code and has the following signature:
case class OffsetFetchRequest(groupId: String,
requestInfo: Seq[TopicAndPartition],
versionId: Short = OffsetFetchRequest.CurrentVersion,
correlationId: Int = 0,
clientId: String = OffsetFetchRequest.DefaultClientId)
I can send all the requested parameters except Seq[TopicAndPartition].
On the Java side, I have the following code:
OffsetFetchRequest offsetFetchRequest = new OffsetFetchRequest(
"someGroup",
topicAndPartitions,
(short)1,
1,
"clientId");
As expected, a is java.util.Listincompatible with Scala Seq. However, I have tried all types of conversion methods in JavaConversionsand JavaConverters, and I can not find anything that matches this case.
How to create Scala Seqfrom the usual java.util.Listor even java.util.Collection? Or am I getting it wrong?
source
share