[rabbitmq-discuss] rabbmitmq - app hangs while calling login user method...
shivang vyas
shivangvyas2008 at gmail.com
Sat May 25 09:55:07 BST 2013
using this library for ios rabbitmq client
integration: https://github.com/bimawa/librabbitmq-objC
here is an iOS - obj C code:
}
-(void)establish{
AMQPConnection *connection = [[AMQPConnection alloc] init];
NSError *error, *error1,*error2,*error3;
[connection connectToHost:<hostname> onPort:<portno> error:&error] ?
NSLog(@"Connected to host"):NSLog(@"not connected to host");
[connection loginAsUser:@"guest" withPasswort:@"guest"
onVHost:@"/" error:&error1];
AMQPChannel *channel = [connection openChannel];
AMQPExchange * exchange = [[AMQPExchange alloc] initExchangeWithName
:<exchangename>
onChannel
:channel];
AMQPQueue *queue = [[AMQPQueue alloc] initWithName:@"my_queue" onChannel
:channel];
[queue bindToExchange:exchange withKey:@"99999" error:&error3];
AMQPConsumer *consumer = [[AMQPConsumer alloc] initForQueue:queue
onChannel:&channel
useAcknowledgements:YES
isExclusive:NO
receiveLocalMessages:NO
error:&error2
deepLoop:5];
AMQPConsumerThread *consumerThread = [[AMQPConsumerThread alloc]
initWithConsumer:consumer delegate:(id)self nameThread:@"shivng_thread"];
[consumerThread start];
}
-(void)amqpConsumerThreadReceivedNewMessage:(AMQPMessage*)theMessage{
NSLog(@"message = %@", theMessage);
NSLog(@"message.body = %@", theMessage.body);
}
-(void)amqpConsumerThreadLoseConnection{
NSLog(@"Consumer thread lost connection");
}
application just got hanged while calling :
[connection loginAsUser:@"guest" withPasswort:@"guest"
onVHost:@"/" error:&error1];
the reason is, function:
result = recv(state->sockfd, state->sock_inbound_buffer.bytes,state->
sock_inbound_buffer.len, 0);
doesn't return back, just waiting waiting......
app waiting for executing next other statements after the above line...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130525/c867ec81/attachment.htm>
More information about the rabbitmq-discuss
mailing list