The first chapter. Installation, introduction and preliminary study
Chapter Two. Exchange,queue,binding Introduction Subscription Publishing Work queue (consumer cluster)
This chapter concludes with an introduction to API CommandLine and other features
Source Address Https://github.com/dubing/MaoyaRabbit
RabbitMQ API
RabbitMQ Server provides a rich HTTP API.
Give me an example.
HTTP Basic authentication is required. The default user name/password is guest/guest.
These returns are worth the meaning I have moved from the official website to explain, in order to avoid the translation of the problem caused everyone to understand the error here directly to the original text
cluster_name |
The name of the entire cluster, as set with rabbitmqctl set_cluster_name . |
erlang_full_version |
A string with extended detail about the Erlang VMs and how it is compiled, for the node connected to. |
erlang_version |
A string with the Erlang version of the that node connected to. As clusters should all run the same version this can be taken as representing the cluster. |
exchange_types |
A List of all Exchange types available. |
listeners |
All (non-http) network listeners-nodes in the cluster. (See in for contexts /api/nodes HTTP). |
management_version |
Version of the management plugin in use. |
message_stats |
A Message_stats object for everything the user can see-for all vhosts regardless of permissions in the case of and monitoring administrator users, and for all vhosts the user have access to for other users. |
node |
The name of the cluster node this management plugin instance are running on. |
object_totals |
An object containing global counts of all connections, channels, exchanges, queues and consumers, subject to the same Visi Bility rules as for message_stats . |
queue_totals |
An object containing sums messages of a, and fields for all messages_ready messages_unacknowledged queues, again subject to the same visibility rules As for message_stats . |
rabbitmq_version |
Version of RabbitMQ on the node which processed this request. |
statistics_db_node |
Name of the cluster node hosting the management statistics database. |
statistics_level |
Whether the node is running fine or coarse statistics. |
or query the virtual host through the API
Many API URIs require the name of a part of a virtual host path, because the name only uniquely identifies the object in a virtual host. As the default virtual host is called "/", this?? will need to be encoded as "%2f".
The corresponding API function in my demo program can be implemented by the function here.
Its richer features can be found in the official website documentation http://hg.rabbitmq.com/rabbitmq-management/raw-file/3646dee55e02/priv/www-api/help.html
and http://hg.rabbitmq.com/rabbitmq-management/raw-file/rabbitmq_v3_3_5/priv/www/api/index.html
In general, I have given in the application, for example, to view all queues, etc.
RabbitMQ CommandLine
In addition to the rich HTTP API,RABBITMQ Server nature also has its very full command line.
For example, query all Exchange.
Query all queues and the number of messages they contain
Rabbitmqctl More command instructions refer to http://www.rabbitmq.com/man/rabbitmqctl.1.man.html
The difference between the basicget of a message and consume
Consume function of the introduction, Basicget more inclined to our usual use of other types of MessageQueue, it is the most basic acceptance of the message, consume consumption for basicget belongs to a long connection to the difference between short connections.
Once the consumer relationship is determined, it basically defaults to whether the message on the listening channel is in production. The basicget is controlled manually by the client.
In the demo, distinguish between the shown
If you choose to consume messages, then basically the code level is done.
var consumer = new Queueingbasicconsumer (channel); Channel. Basicqos (0, 1, false); Channel. Basicconsume (Queue.name, rbacktrue.checked, consumer); while (true) { var e = consumer. Queue.dequeue (); MessageBox.Show (String. Format ("queue {0} get message {1}, Thread id = {2}", Queue.name, Encoding.ASCII.GetString (e.body), process.getcurrentprocess (). Id)); Thread.Sleep (+); }
The previous section describes how consumers do distributed or cluster, many students may be interested in the server-side cluster, given the single-machine application here is not much introduced, give the official website of the portal
Http://www.rabbitmq.com/clustering.html
The end of this article is a bit incompatible the intention is to follow the previous plan to release the source code hope to help everyone
A WinForm take you to play RABBITMQ (c) attached source code