如何集成rabbit mq客户端库
Posted
技术标签:
【中文标题】如何集成rabbit mq客户端库【英文标题】:How to integrate rabbit mq client library 【发布时间】:2014-10-22 10:15:41 【问题描述】:在大量搜索 Rabbit MQ 时,我找到了 librabbitmq-c
的目标 C 包装器,其链接指向 librabbitmq-objc。
对于 librabbitmq-c 链接找到https://github.com/alanxz/rabbitmq-c。
我试图将两者集成到我的应用程序中,但会产生很多错误,例如
i) <Cocoa/Cocoa.h> file not found
ii) <amqp.h> file not found
iii)Too few arguements passing to amqp_basic_consume() method in AMQPConsumer.m
iv) Use of undeclared identifier AMQ_PLATFORM in amqp_socket.c file.
v) Use of undeclared identifier AMQP_EXCHANGE_TYPE_DIRECT in AMQPExchange.m
vi) ""---------""----- ""------- AMQP_EXCHANGE_TYPE_FANOUT in ""---""-------
vii)--""-----------""----------- AMQP_EXCHANGE_TYPE_TOPIC in ""----""-------
我还通过此链接https://github.com/alanxz/rabbitmq-c/releases/download/v0.5.2/rabbitmq-c-0.5.2.tar.gz尝试了最新版本的 librabbitmq-c
通过将<Cocoa/Cocoa.h>
替换为<Foundation/Foundation.h>
解决了第一个和第二个问题
和<amqp.h>
和"amqp.h"
但我无法解决其余的问题
我的客户端库实现如下:-
NSString *workQueueName = @"MyQueue";
AMQPExchange *exchange;
AMQPConnection *connection = [[AMQPConnection alloc] init];
[connection connectToHost:@"localhost" onPort:5672];
[connection loginAsUser:@"guest" withPasswort:@"guest" onVHost:@"/"];
AMQPChannel *receiverChannel = [connection openChannel];
AMQPQueue *queue = [[AMQPQueue alloc] initWithName:workQueueName
onChannel:receiverChannel
isPassive:NO
isExclusive:NO
isDurable:NO
getsAutoDeleted:YES];
exchange = [[AMQPExchange alloc] initFanoutExchangeWithName:@"EXCHANGE_NAME" onChannel:receiverChannel isPassive:NO isDurable:NO getsAutoDeleted:NO];
[queue bindToExchange:exchange withKey:workQueueName];
AMQPConsumer *consumer = [[AMQPConsumer alloc] initForQueue:queue onChannel:receiverChannel useAcknowledgements:NO isExclusive:NO receiveLocalMessages:YES];
AMQPConsumerThread *wqThread = [[AMQPConsumerThread alloc] initWithConsumer:consumer];
wqThread.delegate = self;
[wqThread start];
任何有关Rabbit MQ 的帮助将不胜感激,谢谢
【问题讨论】:
【参考方案1】:经过很长一段时间我已经解决了。
图书馆请参考此链接
https://dl.dropboxusercontent.com/u/75870052/AMQPLib.zip
详情请参考以下链接...
https://***.com/a/26601155/1305001
【讨论】:
我也对上述问题感到震惊。我有所有库文件,我仍然收到,,,以上是关于如何集成rabbit mq客户端库的主要内容,如果未能解决你的问题,请参考以下文章