Link you to rabbitmq with source code

Source: Internet
Author: User

Rabbitmq API

Rabbitmq server provides a wide range of HTTP APIs.

Give a column

HTTP basic authentication is required. The default username/password is guest/guest.

These returned results are worth explaining from the official website. In order to avoid translation errors that may cause your understanding, the original text is provided here.

Cluster_name The name of the entire cluster, as setRabbitmqctl set_cluster_name.
Erlang_full_version A string with extended detail about the Erlang Vm and how it was compiled, for the node connected.
Erlang_version A string with the Erlang version of the node connected to. As clusters shoshould 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 for all nodes in the cluster. (SeeContextsIn/API/nodesFor 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 caseMonitoringAndAdministratorUsers, and for all vhosts the user has access to for other users.
Node The name of the cluster node this management plugin instance is running on.
Object_totals An object containing global counts of all connections, channels, exchanges, queues and consumers, subject to the same Visibility rules asMessage_stats.
Queue_totals An object containing sums ofMessages,Messages_readyAndMessages_unacknowledgedFields for all queues, again subject to the same Visibility rules asMessage_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 virtual hosts through APIS.

Many API Uris require the names of some parts of a VM path, because the names are only unique in a VM to recognize objects. As the default virtual host, it is called "/". What is this ?? Will be encoded as "% 2f ".

The corresponding API functions in my demo program can be implemented through the functions here

Its more rich functions can refer to the official website instructions 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 already provided a list in the application, such as viewing all queues.

 Rabbitmq CommandLine

In addition to the rich HTTP APIs, rabbitmq server naturally has comprehensive command lines.

For example, query all exchange.

Query all queues and the number of messages they contain

More instructions on rabbitmqctl refer to http://www.rabbitmq.com/man/rabbitmqctl.1.man.html

Difference between message basicget and consume

The function of consume is described in the previous article. basicget is more inclined to other types of messagequeue that we have used at ordinary times. It is the most basic message acceptance, consume consumption is a difference between a persistent connection and a short connection for basicget.

Once the consumer relationship is determined, it basically means whether the messages in the listening channel are in production by default. While basicget is manually controlled by the client.

Differentiate in demo

If you choose to consume messages, the code is basically done in this way.

123456789 var consumer = new QueueingBasicConsumer(channel);channel.BasicQos(0, 1,false);channel.BasicConsume(queue.name, rbAckTrue.Checked, consumer);while (true){    vare = consumer.Queue.Dequeue();    MessageBox.Show(string.Format("队列{0}获取消息{1},线程id为{2}", queue.name, Encoding.ASCII.GetString(e.Body), Process.GetCurrentProcess().Id));    Thread.Sleep(1000);}

Link you to rabbitmq with source code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.