I am trying to create a Scala map from 2 Java classes:
TopicPartition(java.lang.String topic, int partition)
OffsetAndMetadata(long offset)
Does this look correct?
val topicPartition = new TopicPartition("sometopicname", 99)
val offsetAndMetadata = new OffsetAndMetadata(999999L,"tette")
val mapTopicOffset = Map(topicPartition -> offsetAndMetadata)
Also need to create a method that will accept this map as input parameter.
Tried something like:
def commitSync(offsets: Map[TopicPartition, OffsetAndMetadata] ) = {
}
Got error:
Error:(239, 37) type mismatch;
found : Map[org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata] (in scala.collection.immutable)
required: Map[org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata] (in java.util)
verify(kc, times(1)).commitSync(mapTopicOffset)
Is there a way to provide overloaded method that will take a scala map? (not sure how to write that)
Or maybe everything should be rewritten differently (from starting of creating objects etc.)?