Wikipedista:Pavel.mlejnek/Pískoviště

RabbitMQ
[[Soubor:Soubor:RabbitMQLogo.png|200px|alt=Logo|Logo]]
VývojářPivotal Software
Aktuální verze3.5.5 (Šablona:Release date)
Operační systémMultiplatformní
Vyvíjeno vErlang
Typ softwaruAMQP, message-oriented middleware
LicenceMozilla Public License
Webwww.rabbitmq.com

RabbitMQ is an open source message broker software (sometimes called message-oriented middleware) that implements the Advanced Message Queuing Protocol (AMQP). The RabbitMQ server is written in the Erlang programming language and is built on the Open Telecom Platform framework for clustering and failover. Client libraries to interface with the broker are available for all major programming languages.

Rabbit Technologies Ltd., develops and provides support for RabbitMQ. Rabbit Technologies started as a joint venture between LShift and CohesiveFT in 2007,[1] and was acquired in April 2010 by SpringSource, a division of VMware.[2] The project became part of GoPivotal in May 2013.[3]

Zdrojový kód je zveřejněn pod licencí Mozilla Public License. Projekt se skládá z těchto částí:

  • The RabbitMQ exchange server itself
  • Gateways for HTTP, Streaming Text Oriented Messaging Protocol (STOMP), and MQTT protocols
  • AMQP client libraries for Java, .NET Framework, and Erlang. (AMQP clients for other languages are available from other vendors.)
  • A plug-in platform for custom additions, with a pre-defined collection of supported plug-ins, including:
    • A "Shovel" plug-in that takes care of moving or copying (replicating) messages from one broker to another.
    • A "Federation" plug-in that enables efficient sharing of messages between brokers (at the exchange level).
    • A "Management" plug-in that enables monitoring and control of brokers and clusters of brokers.

Příklady editovat

This section gives sample programs written in python for sending and receiving messages using a queue.

Sending editovat

The following code fragment establishes a connection, makes sure the recipient queue exists, then sends a message and finally closes the connection.

#!/usr/bin/env python
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_publish(exchange='', routing_key='hello', body='Hello World!')
print " [x] Sent 'Hello World!'"
connection.close()

Receiving editovat

Similarly, the following program receives messages from the queue and prints them on the screen:

#!/usr/bin/env python
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
print ' [*] Waiting for messages. To exit press CTRL+C'
def callback(ch, method, properties, body):
    print " [x] Received %r" % (body,)
channel.basic_consume(callback, queue='hello', no_ack=True)
channel.start_consuming()

See also editovat

Šablona:Portal

Reference editovat

  1. Launch of RabbitMQ Open Source Enterprise Messaging. Press release. February 8, 2007. Dostupné online [cit. October 23, 2013]. 
  2. Rabbit Technologies announce acquisition by SpringSource. Press release. April 13, 2010. Dostupné v archivu pořízeném z originálu dne April 18, 2010. 
  3. Proudly part of Pivotal. Press release. May 14, 2010. Dostupné v archivu pořízeném z originálu dne June 2, 2013. 

Further reading editovat

Externí odkazy editovat