RabbitMQ Obj-C client connection status check

时光总嘲笑我的痴心妄想 提交于 2020-01-17 05:48:05

问题


I'm using rabbitmq/rabbitmq-objc-client. Is there a way how to check if connection was opened successfully? I see there is RMQConnectionDelegate but there are only methods that are called when an error appears. I'm looking for something like

RMQConnection *conn = [[RMQConnection alloc] /*...*/];
if ([conn isOpen]) {
    /* ... */
}

回答1:


You can do this:

[conn start:^{ // code to execute when connection established }];

But note that the client is async and all channel operations are placed onto a queue for execution after the connection is established.

I've added a note to the issue Michael opened: https://github.com/rabbitmq/rabbitmq-objc-client/issues/101



来源:https://stackoverflow.com/questions/39849763/rabbitmq-obj-c-client-connection-status-check

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!