flexlixrup/pulsar-client-swift
`pulsar-client-swift` is a native Swift wrapper library for the [Apache Pulsar™ C++ client library](https://pulsar.apache.org/docs/4.1.x/client-libraries-cpp/). It provides an idiomatic Swift API (Client, Producer, Consumer, Message, etc.) while calling into the upstream C++ clie
Quick start
Example (synchronous send):
import Pulsar
let client = Client(serviceURL: URL(string: "pulsar://localhost:6650")!)
do {
let producer: Producer<String> = try client.createProducer(topic: "my-topic")
let message = Message(content: "Hello Apache Pulsar")
try producer.send(message)
try client.close()
} catch {
print("Pulsar error: \(error)")
}The full documentation is provided via DocC on Swift Package Manager.
Add to your project
To integrate pulsar-client-swift into your project using Swift Package Manager, follow these steps:
- Open your project in Xcode.
- Select
File>Swift Packages>Add Package Dependency.... - Enter the package repository URL:
https://github.com/flexlixrup/pulsar-client-swift-cpp. - Choose the latest release or specify a version range.
- Add the package to your target.
Alternatively, you can add the following dependency to your Package.swift file:
dependencies: [
.package(url: "https://github.com/flexlixrup/pulsar-client-swift-cpp", from: "0.0.1")
]Then, include Pulsar as a dependency in your target:
.target(
name: "YourTargetName",
dependencies: [
"Pulsar"
]),Licensing
This project includes and links against the Apache Pulsar™ C++ client library. The included C++ client is distributed under the Apache License 2.0. Please review the license files:
pulsar-client-swift/LICENSE— license for the Swift wrapperpulsar-client-cpp-bundle/resources/LICENSES/— license/NOTICE files for the bundled Apache Pulsar C++ client
Contributing
[!WARNING] This package uses Conventional Commits to detect the semantic versioning. Commits not following this format will not be accepted.
If you would like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature-branch). - Create a new Pull Request.
Package Metadata
Repository: flexlixrup/pulsar-client-swift
Default branch: main
README: README.md