[rabbitmq-discuss] CL-RABBIT - LispWorks to RabbitMQ via JFLI

Nick Levine ndl at ravenbrook.com
Thu Apr 2 11:17:11 BST 2009

I am very pleased to announce the release of version 0.1 of CL-RABBIT:
an interface from LispWorks to RabbitMQ, an implementation of the AMQP
messaging protocol.


It's released under an MIT-style license, a copy of which appears in
each source file. Many thanks to Wiinz Limited for giving me
permission to do all this and I'm sorry it's taken so long to get
around to kicking the brute through the door.


Here's how it goes:

 - Open a connection and a channel (I'll be lazy and use the same
   channel for outgoing and incoming messages), declare exchange and
   queue, bind everything together:

    RABBITMQ 6 > (setf my-connection (new-connection "localhost" "/"))
    #<AMQCONNECTION. amqp://guest@localhost:5672/ 200DCD87>

    RABBITMQ 7 > (setf my-channel (new-channel my-connection))
    #<CHANNEL AMQChannel(amqp://guest@localhost:5672/,1) 200F7BB3>

    RABBITMQ 8 > (declare-exchange my-channel "my exchange" :direct)
    #<|com.rabbitmq.client.impl|::AMQIMPL$EXCHANGE$DECLAREOK. 2009159F>

    RABBITMQ 9 > (declare-queue my-channel "my queue")
    #<|com.rabbitmq.client.impl|::AMQIMPL$QUEUE$DECLAREOK. 21D050CF>

    RABBITMQ 10 > (bind-queue my-channel "my queue" "my exchange" "my routing key")
    #<|com.rabbitmq.client.impl|::AMQIMPL$QUEUE$BINDOK. 21CEEFD3>

 - Send a message into the void:

    RABBITMQ 11 > (setf outgoing-message (new-message))

    RABBITMQ 12 > (setf (message-id outgoing-message) "42"
			(message-body outgoing-message) "Hello, World")
    "Hello, World"

    RABBITMQ 13 > (publish outgoing-message my-channel "my exchange" "my routing key")

 - And get it back again:

    RABBITMQ 14 > (consume-queue my-channel "my queue")
    "amq.ctag1_rabbit at gannet_20090402084407_"

    RABBITMQ 15 > (channel-arrived-count my-channel)

    RABBITMQ 16 > (setf incoming-message (next-message my-channel))

    RABBITMQ 17 > (values (message-body incoming-message)
			  (message-id incoming-message))
    "Hello, World"

    RABBITMQ 18 > 

More information about the rabbitmq-discuss mailing list