RabbitMQ client for Objective-C and Swift
A RabbitMQ client, largely influenced by Bunny.
Test-driven from Swift and implemented in Objective-C.
This library currently targets iOS 12+ and macOS 10.12+.
This library depends on
github "rabbitmq/rabbitmq-objc-client" "v0.13.0"
Run Carthage, for example in a new project:
carthage bootstrap
Carthage/Build/iOS/RMQClient.framework
Add the following to your Podfile:
pod 'RMQClient', git: 'https://github.com/rabbitmq/rabbitmq-objc-client.git'
We recommend adding use_frameworks!
to enable modular imports (Objective-C only).
Run pod install
.
Open your project with open MyProject.xcworkspace
.
Objective-C users: importing with @import RMQClient;
currently produces an error in Xcode (Could not build module ‘RMQClient’), but this should not prevent code from compiling and running. Using crocodile imports avoids this Xcode bug: #import <RMQClient/RMQClient.h>
.
Instantiate an RMQConnection
:
let delegate = RMQConnectionDelegateLogger() // implement RMQConnectionDelegate yourself to react to errors
let conn = RMQConnection(uri: "amqp://guest:guest@localhost:5672", delegate: delegate)
Connect:
conn.start()
Create a channel:
let ch = conn.createChannel()
Use the channel:
let q = ch.queue("myqueue")
q.subscribe({ m in
print("Received: \(String(data: m.body, encoding: String.Encoding.utf8))")
})
q.publish("foo".data(using: String.Encoding.utf8))
Close the connection when done:
conn.close()
See the tutorials for more detailed instructions.
See CONTRIBUTING.md.
Copyright © 2005-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
This package, the RabbitMQ Objective-C client library, is
dual-licensed under the Mozilla Public License 2.0 (“MPL”) and the
Apache License version 2 (“ASL”).