【发布时间】:2016-12-16 03:38:52
【问题描述】:
我有一个 Objective C 提供程序,它向远程 RMQ 服务器上的交换器提交消息。
我有一个消费者正在监听绑定到该交换的队列。我正在使用扇出。
当从 Xcode 运行应用程序一切正常时,消息被发送并且消费者接收它。
但是,当从 iPhone 设备运行应用程序时,消息不会显示在管道的末尾。
这是我的发送方法:
- (void) send {
RMQConnection *conn = [[RMQConnection alloc] initWithUri:@"amqp://<user>:<pass>@<ip>:5672"
delegate:[RMQConnectionDelegateLogger new]];
//RMQConnection *conn = [[RMQConnection alloc] initWithDelegate:[RMQConnectionDelegateLogger new]];
[conn start];
id<RMQChannel> ch = [conn createChannel];
RMQExchange *x = [ch fanout:@"logs"];
NSString *mobilemsg = @"{\"test\" : \"test\" }";
[x publish:[mobilemsg dataUsingEncoding:NSUTF8StringEncoding]];
NSLog(@"Sent %@", mobilemsg);
[conn close];
}
【问题讨论】:
-
虽然看起来不像,但我在 URL 上使用 user:password 组合,如下所示: RMQConnection *conn = [[RMQConnection alloc] initWithUri:@"amqp://user:password@: 5672" 委托:[RMQConnectionDelegateLogger new]];
-
我添加了一个接收方法 - 应用程序确实接收其他非 IOS 客户端发布的消息,进一步看似乎消息从未到达交换器 - 这仅在 IOS 客户端上发生。没有错误信息。
-
似乎是一些配置错误,但我还不确定我错过了什么。
标签: ios objective-c xcode mobile rmq