2017-10-17 7 views
0

pod RMQClientpod install을 사용하여 RMQClient을 프로젝트에 설치합니다. 그런 다음 import <RMQClient/RMQClient.h>ViewController에 입력하십시오. 공식 지침에 따르면 코드를 작성했지만이 프로젝트를 실행하면 핸드 셰이크 시간이 초과되었습니다 오류가 발생했습니다.RMQClient (RabbitMQ) 핸드 셰이크 시간 초과 오류

전체 오류 :

2017-10-17 11:32:06.960214+0800 RMQDemo[1637:557786] Received connection: <RMQConnection: 0x6080000ff780> disconnectedWithError: Error Domain=GCDAsyncSocketErrorDomain Code=8 "Error creating CFStreams" UserInfo={NSLocalizedDescription=Error creating CFStreams} 
2017-10-17 11:32:06.963773+0800 RMQDemo[1637:557786] Received connection: <RMQConnection: 0x6000002e1500> disconnectedWithError: Error Domain=kCFStreamErrorDomainSSL Code=-9847 "(null)" UserInfo={NSLocalizedRecoverySuggestion=Error code definition can be found in Apple's SecureTransport.h} 
2017-10-17 11:32:16.956467+0800 RMQDemo[1637:557769] Received connection: <RMQConnection: 0x6080000ff780> failedToConnectWithError: Error Domain=com.rabbitmq.rabbitmq-objc-client Code=1 "Handshake timed out." UserInfo={NSLocalizedDescription=Handshake timed out.} 
2017-10-17 11:32:16.959851+0800 RMQDemo[1637:557769] Received connection: <RMQConnection: 0x6000002e1500> failedToConnectWithError: Error Domain=com.rabbitmq.rabbitmq-objc-client Code=1 "Handshake timed out." UserInfo={NSLocalizedDescription=Handshake timed out.} 

내 코드 :

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
    [self send]; 
    [self receive]; 
} 
- (void)send 
{ 
    RMQConnection * conn = [[RMQConnection alloc] initWithUri:@"amqps://username:[email protected]:5672" delegate:[RMQConnectionDelegateLogger new]]; 
    [conn start]; 
    id<RMQChannel>channel = [conn createChannel]; 
    RMQQueue * queue = [channel queue:@"hello"]; 
    [channel.defaultExchange publish:[@"hello world" dataUsingEncoding:NSUTF8StringEncoding] routingKey:queue.name]; 
    [conn close]; 
} 
- (void)receive 
{ 
    RMQConnection * conn = [[RMQConnection alloc] initWithUri:@"amqps://username:[email protected]:5672" delegate:[RMQConnectionDelegateLogger new]]; 
    [conn start]; 
    id<RMQChannel>channel = [conn createChannel]; 
    RMQQueue * queue = [channel queue:@"hello"]; 
    [queue subscribe:^(RMQMessage * _Nonnull message) { 
     NSLog(@"message:%@",[[NSString alloc] initWithData:message.body encoding:NSUTF8StringEncoding]); 
    }]; 
    [conn close]; 
} 

어떻게이 문제를 해결하기 위해? 이 프레임 워크를 사용하는 방법?

플랫폼 : 엑스 코드 9, iPhone8 시뮬레이터, iOS11

내가 코드를 확인

답변

0

, 그것은 웹 사이트의 데모 코드에 동일합니다.

오류 정보에서 CFStream을 생성하는 중에 문제가 발생했다고합니다. 오류 코드 -9847에 따르면, 서비스가 지금 작동하지 않을 수도 있습니다. 먼저 서비스 상태를 확인하십시오!

This tutorial assumes RabbitMQ is installed and running on localhost on standard port (5672). In case you use a different host, port or credentials, connections settings would require adjusting.

+0

서비스가 실행 중입니다. – ttxoox