https://kotlinlang.org logo
#announcements
Title
# announcements
s

Shawn A

06/03/2019, 3:15 PM
Kafka has this interface which "gets" a
Processor<K,V>
Copy code
public interface ProcessorSupplier<K, V> {
    Processor<K, V> get();
}
Given I have a class:
Copy code
class EventNotifier : Processor<String, SomeEvent>`
I thought I'd be able to call the
Kstream#process(ProcessorSupplier<? super K, ? super V> var1, String... var2)
method, but I am getting a type mismatch error for:
Copy code
stream.process({ EventNotifier() })
>> Required: Processor<String!, SomeEvent!>!
Found: () -> EventNotifier
k

karelpeeters

06/03/2019, 3:23 PM
Can you try forcing the SAM conversion?
stream.process(ProcessorSupplier { EventNotifier() })
s

Shawn A

06/03/2019, 3:32 PM
@karelpeeters That works
k

karelpeeters

06/03/2019, 3:32 PM
Strange, maybe report an issue.
2 Views