我正在尝试使用RabbitMQ for iOS制作消息传递应用程序.我正在使用RabbitMQ-C客户端库的目标c的包装类.
https://github.com/profmaad/librabbitmq-objc
Exchange,队列和队列绑定都可以,但我的代码不是向RabbitMQ服务器发布消息.请帮帮我,有什么问题?
这是我的代码:
NSError *error= nil;
AMQPConnection *connection = [[AMQPConnection alloc] init];
[connection connectToHost:@"SERVER_NAME" onPort:PORT error:&error];
if (error != nil){
NSLog(@"Error connection: %@", error);
return;
}
[connection loginAsUser:@"USER_NAME" withPasswort:@"PASSWORD" onVHost:@"/" error:&error];
if (error != nil){
NSLog(@"Error logined: %@", error);
return;
}
AMQPChannel *channel = [connection openChannel];
AMQPExchange *exchange = [[AMQPExchange alloc] initFanoutExchangeWithName:@"EXCHANGE_NAME" onChannel:channel isPassive:NO isDurable:NO getsAutoDeleted:NO error:&error];
if (error != nil){
NSLog(@"Error declareExchange: %@", error);
return;
}
//AMQPQueue *queue = [[AMQPQueue alloc] initWithName:@"NAME" onChannel:channel isPassive:NO isExclusive:NO isDurable:YES …Run Code Online (Sandbox Code Playgroud)