Update objc tutorial1 for subscription errors
Also, log before connecting for receive. [#116521563]
This commit is contained in:
parent
8048f89de7
commit
5b47ac5e42
@ -1,3 +1,3 @@
|
||||
github "robbiehanson/CocoaAsyncSocket" "562bae6af6dbd7e1891293dae20b9f79a2fd7228"
|
||||
github "Mantle/Mantle" "cdb82df5dd3a7e4cfab6dfbc48df20dcc80b4e13"
|
||||
github "rabbitmq/rabbitmq-objc-client" "7871c3ab0e731b6cc8b9bb1ac0ef5a410bc035ce"
|
||||
github "rabbitmq/rabbitmq-objc-client" "3e36e6db95769016ea38765ff6255e932867c89d"
|
||||
|
@ -13,10 +13,8 @@
|
||||
}
|
||||
|
||||
- (void)send {
|
||||
RMQConnection *conn = [RMQConnection new];
|
||||
|
||||
NSLog(@"Attempting to connect to local RabbitMQ broker");
|
||||
|
||||
RMQConnection *conn = [RMQConnection new];
|
||||
NSError *error = NULL;
|
||||
[conn startWithError:&error];
|
||||
if (error) {
|
||||
@ -38,6 +36,7 @@
|
||||
}
|
||||
|
||||
- (void)receive {
|
||||
NSLog(@"Attempting to connect to local RabbitMQ broker");
|
||||
RMQConnection *conn = [RMQConnection new];
|
||||
NSError *error = NULL;
|
||||
[conn startWithError:&error];
|
||||
@ -55,11 +54,14 @@
|
||||
|
||||
RMQQueue *q = [ch queue:@"hello"];
|
||||
NSLog(@"Waiting for messages.");
|
||||
[q subscribe:^(id<RMQMessage> _Nonnull m) {
|
||||
NSLog(@"Received %@", m.content);
|
||||
[conn close];
|
||||
exit(0);
|
||||
[q subscribeWithError:&error handler:^(id<RMQMessage> _Nonnull message) {
|
||||
NSLog(@"Received %@", message.content);
|
||||
}];
|
||||
if (error) {
|
||||
NSLog(@"Error subscribing: %@", error);
|
||||
[conn close];
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user