[rabbitmq-discuss] rmqid v0.2.0 released - a Python 2 & 3 client library (alpha)

Gavin M. Roy gmr at meetme.com
Sun Mar 24 06:18:39 GMT 2013


I am pleased to announce the alpha release of rmqid 0.2.0. 

rmqid is an experimental library designed to make interacting with RabbitMQ via python a more pleasant experience. It is BSD licensed and currently supports Python 2.6, 2.7 and 3.3. I do not consider this a replacement for Pika, which I fully intend to continue supporting, developing and maintaining. rmqid will most likely never support an asynchronous programming model and aims to create a low barrier to entry, sacrificing the more low-level API that Pika provides.

Please note that I do not consider the library stable and it is not intended for production use at this point. I consider the code alpha quality and am releasing v0.2.0 for feedback and testing. There are numerous yet to be implemented features.

You can install rmqid via the python package index: pip install rmqid

The github repo is located at https://github.com/gmr/rmqid and documentation is coming but currently not available. Be sure to checkout the README and the code in the GitHub repo for more information.

A few of the notable features:

The API for rmqid follows the AMQP specification contextually, yet does not always go back to the channel (from an API perspective) for communicating with RabbitMQ. Instead, the RPC methods are called on the Class objects themselves, only referencing the channel in the construction of the class object:

    connection = rmqid.Connection('amqp://guest:guest@localhost:5672/%2F')
    channel = connection.channel()

    exchange = rmqid.Exchange(channel, 'test-exchange', 'topic')
    exchange.bind()

    queue = rmqid.Queue(channel, 'test-channel')
    queue.declare()
    queue.bind(exchange, 'test-routing-key')
    print 'There are %i messages in the queue' % len(queue)

Connections and Channels can act as context managers:

    with rmqid.Connection('amqp://guest:guest@localhost:5672/%2F') as connection:
    with connection.channel() as channel:
      queue = rmqid.Queue(channel, 'my-test-queue')
      queue.declare()

Messages are consumed using a Queue.consumer() provided context manager that provides a Consumer.next_message() generator method:

  with queue.consumer() as consumer:
    for message in consumer.next_message():
      print message.body
      message.ack()

Messages are core objects in rmqid and interacted with like any other object, Basic.Publish is invoked by calling the publish method on the Message object itself:

  message_body = 'This is my message'
  properties = {'app_id': 'test', 'content_type': 'text/plain', 'delivery_mode': 1}
  message = rmqid.Message(channel, message_body, properties)
  message.publish('test-exchange', 'routing-key')

If you're brave enough to play around with rmqid at this point, please submit bug reports and feature requests at https://github.com/gmr/rmqid/issues.

Cheers,

Gavin 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130324/46fb1bb7/attachment.htm>


More information about the rabbitmq-discuss mailing list