New consumer API
Pre-release
Pre-release
This release includes a new consumer API that makes it easier to start and stop listening to topics.
Here is an example using the new Consumer
class:
let consumer = cluster.getConsumer(topics: ["foo", "bar"], groupId: "testGroup")
consumer.listen { message in
let string = String(data: message.value, encoding: .utf8)!
print(string)
}
The existing consumer classes, SimpleConsumer
and HighLevelConsumer
are still around but have been deprecated.