RabbitMQ API

  RabbitMQ Server它提供了丰富的http api。

  对于列子

  

  须要HTTP基本身份验证。默认的username/password为guest/guest。

  这些返回值得意义我从官网搬来解释,为了避免翻译的问题导致大家理解的误差这里直接给出原文

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 VM and how it was compiled, for the node connected to.
erlang_version A string with the Erlang version of the 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 for all nodes in the cluster. (See contexts in /api/nodes for 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 monitoring and administrator users, 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 as for message_stats.
queue_totals An object containing sums of the messagesmessages_ready and messages_unacknowledged fields for all 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.

  又或者通过api查询虚拟主机

  

  很多api的URI须要一个虚拟主机路径的一部分的名字,由于名字仅仅有唯一在一个虚拟主机识别物体。作为默认的虚拟主机称为“/”,这​​将须要被编码为“%2F”。

  在我的demo程序中相应的api功能能够通过这里的功能来实现

  

  其更丰富的功能能够參考官网说明文档 http://hg.rabbitmq.com/rabbitmq-management/raw-file/3646dee55e02/priv/www-api/help.html

  以及 http://hg.rabbitmq.com/rabbitmq-management/raw-file/rabbitmq_v3_3_5/priv/www/api/index.html

  一般来说我们经常使用的我在应用程序中已经给出 比如查看全部队列等

  


RabbitMQ CommandLine

  除了丰富的http api,rabbitmq server自然也有其非常全面命令行。

  比如查询全部exchange。

  

  查询全部队列以及他们包括的消息数目

   

  rabbitmqctl很多其它的命令说明參考 http://www.rabbitmq.com/man/rabbitmqctl.1.man.html


Message的BasicGet于consume的差别

  consume的功能上一张介绍过,basicget更偏向于我们平时用过的其它类型的MessageQueue,它就是最主要的接受消息,consume的消费针对basicget来说属于一个长连接于短连接的差别。

消费者关系一旦确定。基本上默认它就是在侦听通道的消息是否在生产。而basicget则是由client手动来控制。

  在demo中在下图所看到的处区分

  

  假设你选择了消费消息,那么基本上代码层面是这样来完毕的

1
2
3
4
5
6
7
8
9
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("队列{0}获取消息{1},线程id为{2}",
queue.name, Encoding.ASCII.GetString(e.Body), Process.GetCurrentProcess().Id));
    Thread.Sleep(1000);
}

版权声明:本文博客原创文章。博客,未经同意,不得转载。

乐趣与你rabbitMQ 源代码的更多相关文章

  1. CentOS6.5中配置Rabbitmq3.6.6集群方案

    一.安装Erlang环境 1.下载erlang源代码 wget http://erlang.org/download/otp_src_19.1.tar.gz 2.安装依赖相关库文件 yum insta ...

  2. Shell 脚本实现 Linux 系统监控

    一.实验介绍 1.1 实验内容 本课程实现 shell 脚本监控系统的各项参数,并可以将脚本加入系统环境中,可以直接在终端里执行.还添加了几个参数,一个脚本可以执行不同的操作. 1.2 知识点 本实验 ...

  3. 使用专业的消息队列产品rabbitmq之centos7环境安装

      我们在项目开发的时候都不可避免的会有异步化的问题,比较好的解决方案就是使用消息队列,可供选择的队列产品也有很多,比如轻量级的redis, 当然还有重量级的专业产品rabbitmq,rabbitmq ...

  4. RabbitMQ学习系列(五): RPC 远程过程调用

    前面讲过一些RabbitMQ的安装和用法,也说了说RabbitMQ在一般的业务场景下如何使用.不知道的可以看我前面的博客,http://www.cnblogs.com/zhangweizhong/ca ...

  5. 在Linux上编译dotnet cli的源代码生成.NET Core SDK的安装包

    .NET 的开源,有了更多的DIY乐趣.这篇博文记录一下在新安装的 Linux Ubuntu 14.04 上通过自己动手编译 dotnet cli 的源代码生成 .net core sdk 的 deb ...

  6. 冰冻三尺非一日之寒--rabbitMQ,redis

    第11章 1.rabbitMQ   2. redis 一.rabbitMQ: 人们写了有好多好多的开源的MQ服务器.其中大多数都是写出来用来解决特定问题的.它们不关心上面跑的是什么类型的消息,设计思想 ...

  7. RabbitMQ 声明Queue时的参数们的Power

    参数们的Power 在声明队列的时候会有很多的参数 public static QueueDeclareOk QueueDeclare(this IModel model, string queue ...

  8. .NET中RabbitMQ的使用

    概述 MQ全称为Message Queue, 消息队列(MQ)是一种应用程序对应用程序的通信方法.RabbitMQ是一个在AMQP基础上完整的,可复用的企业消息系统.他遵循Mozilla Public ...

  9. kbengine0.4.20源代码分析(一)

    基于kbengine 0.4.2 MMOPG服务端是一种高品质的工程项目,品读开源的kbe是一种乐趣.本文档我带童鞋们一起领略一下.囿于我知识面和经验方面所限,文中所述之处难免有错误存在,还请读童鞋们 ...

随机推荐

  1. Visual Studio 2015 中文企业版及专业版 正式版下载地址 激活秘钥 正版key

    Visual Studio 简体中文企业版 2015 (x86 and x64)文件名 cn_visual_studio_enterprise_2015_x86_x64_dvd_6846222.iso ...

  2. Zen Coding 快速编写HTML/CSS代码的实现

    在本文中我们将展示一种新的使用仿CSS选择器的语法来快速开发HTML和CSS的方法.它由Sergey Chikuyonok开发. 你在写HTML代码(包括所有标签.属性.引用.大括号等)上花费多少时间 ...

  3. 数据库 版本号是 661,打不开。此server支持 655 和更早的版本号。不支持降级路径

    "数据库 的版本号为 661,无法打开.此server支持 655 版及更低版本号. 不支持降级路径" 出现这种问题,通常是由于数据库版本号不同造成的. 我们能够用以下的语句查询数 ...

  4. 解决无法切换到jenkins用户的问题

    su - jenkins一直有效,今天在centos发现无效,原因是 /etc/password文件里的/bin/bash被yum安装的时候变成了/bin/false. 改动后就能够了. ubuntu ...

  5. 在内存中建立 MySQL 的临时目录(转)

    MySQL 系统会在内存(MEMORY)和磁盘(MyISAM)中建立临时表,如何能知道在磁盘中建立了多少临时表以及在内存中建立多少临时表呢?你可以通过下面命令获知: ? 1 2 3 4 5 6 7 m ...

  6. ZipDemo

    package swing.zip; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt. ...

  7. 5、Cocos2dx 3.0小游戏开发的例子寻找测试三个简单的介绍和总结

    繁重的劳动开发商,当转载请注明出处:http://blog.csdn.net/haomengzhu/article/details/27186557 測试例子简单介绍 Cocos2d-x 为我们提供了 ...

  8. Android UI法宝发展Angrytools

    最近很多人问我,个人App开发商如何设计UI. 其实这是个人开发者最头疼,谁在搞技术,真的不能做的一切.不可能花大量的时间去切图,去做原型设计,去做美工. 当然,尽管我们设计不出那么复杂,静止的UI. ...

  9. ThreadPoolExecutor的一点理解

    整个ThreadPoolExecutor的任务处理有4步操作: 第一步,初始的poolSize < corePoolSize,提交的runnable任务,会直接做为new一个Thread的参数, ...

  10. Linking pronunciation in English

    1.constant+vowel stand up give up get up 2.vowel+vowel 2.1 i:/i/ei/ai/oi [j] stay up carry it 2.2 u: ...