Swiftpack.co - Package - kellanburket/franz

Franz

Build Status Version License Platform Carthage compatible

Franz is an Apache Kafka 0.9.0 client for iOS and macOS.

Usage

import Franz

let cluster = Cluster(brokers: [("localhost", 9092)], clientId: "FranzExample")

let consumer = cluster.getConsumer(topics: ["test"], groupId: "group")
consumer.listen { message in
	print(String(data: message.value, encoding: .utf8)!)
}

cluster.sendMessage("test", message: "Hello world!")

You can view the documentation here.

The current release of Franz should be considered beta. It is not necessarily ready for production code.

The repo has example projects for CocoaPods and Swift Package Manager.

Installation

CocoaPods

Add the following line to your Podfile:

pod "Franz"

Swift Package Manager

Add the following dependency to your Package.swift:

dependencies: [
    .package(url: "https://github.com/kellanburket/franz.git", from: "1.1.0"),
],
targets: [
    .target(name: "MyTarget", dependencies: ["Franz"])
]

Carthage

Add the following dependency to your Cartfile:

github "kellanburket/franz" ~> 1.1.0

Author

Kellan Cummings

Luke Lau

License

Franz is available under the MIT license. See the LICENSE file for more info.

Github

link
Stars: 29
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

1.1 - Apr 25, 2018

You can now connect to clusters with PLAIN authentication:

let cluster = Cluster(brokers: [("localhost", 9092)],
                      clientId: "saslClient",
                      authentication: .plain(username: "franz", password: "password"))

You can also create new topics:

cluster.createTopic(name: "myTopic", partitions: 3, replicationFactor: 2)

1.0.1 - Mar 7, 2018

This release has internal changes that require Swift 4.1

1.0.0 - Oct 6, 2017

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.

0.2.0 - Sep 2, 2017