[rabbitmq-discuss] Simple C Client to read from a Queue

Sajith Kariyawasam sajhak at gmail.com
Fri Sep 7 08:11:29 BST 2012


Thanks for the clue,

I tried using it with following code,

  die_on_error(sockfd = amqp_open_socket(hostname, port), "Opening socket");
  conn = amqp_new_connection();
  amqp_set_sockfd(conn, sockfd);
  die_on_amqp_error(amqp_login(conn, "/", 0, 131072, 0,
AMQP_SASL_METHOD_PLAIN, "guest", "guest"),"Logging in");
  if (!amqp_channel_open(conn, 1))
                die_on_amqp_error(amqp_get_rpc_reply(conn), "opening
channel");
  reply =  amqp_basic_get(conn,1,amqp_cstring_bytes(queuename),1);

I would like to verify whether the set of methods I have invoked and the
order of invocation are correct ?



On Thu, Sep 6, 2012 at 4:53 PM, Tim Watson <tim at rabbitmq.com> wrote:

> On 6 Sep 2012, at 12:11, Tim Watson wrote:
>
>
> No, the listenq.c sample is the one you want. It really does seem that
> you're trying to get someone to write your C code for you though - as I
> said, just remove the looping - and whilst we are very keen to help with
> rabbit questions, I suspect this might be going a bit far even for the more
> enthusiastic among us. ;)
>
>
> In fact looking at the sources for a couple of minutes now, you'll be
> better off using amqp_basic_get. I didn't notice that at first. There
> didn't seem to be an example of using that in the repository, so I now
> understand why you were struggling to see what to do. The returns a
> amqp_rpc_reply_t struct, from which you can probably get you want via the
> reply field.
>
> amqp_rpc_reply_t amqp_basic_get(amqp_connection_state_t state,
> 				amqp_channel_t channel,
> 				amqp_bytes_t queue,
> 				amqp_boolean_t no_ack)
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>


-- 
Best Regards
Sajith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120907/ebf0de84/attachment.htm>


More information about the rabbitmq-discuss mailing list