[racket] Problems wrapping the RabbitMQ C client library using the ffi

From: Tony Garnock-Jones (tonyg at ccs.neu.edu)
Date: Sun Aug 26 13:31:41 EDT 2012

Hi Juan,

On 2012-08-26 1:10 PM, Juan Garcia wrote:
> I'm having a problem wrapping the Rabbit MQ C client
> library (https://github.com/alanxz/rabbitmq-c) using the ffi.  My
> problem is with the amqp_queue_declare function. [...]

While I don't immediately see the problem with your FFI interface to
librabbitmq, I'd like to point out that it's a very low-level library,
and so is quite difficult to use. If there's nothing AMQP-specific about
your messaging needs, I recommend enabling the RabbitMQ STOMP
server-side adapter and using (require (planet tonyg/stomp)).

The main advantage is that the pure-Racket implementation of the client
side of the protocol means no SIGSEGVs, no shared-library dependencies,
and cross-platform support.

Here's a small example of subscribing to a topic using racket-stomp:

(require (planet tonyg/stomp))
(define s (stomp-connect "dev.rabbitmq.com" "guest" "guest" "/"))
(stomp-subscribe s "/exchange/amq.rabbitmq.log/#" "s1")
(let loop ()
  (let ((m (stomp-next-message s "s1")))
    ... m ... (loop) ...))
(stomp-unsubscribe s "s1")
(stomp-disconnect s)

Documentation etc. for racket-stomp is available here:


Posted on the users mailing list.