zoukankan      html  css  js  c++  java
  • RabbitMQ (Channel参数篇)

    Channel 

    1:方法ExchangeDeclare

    void ExchangeDeclare(string exchange, string type, bool durable, bool autoDelete, IDictionary<string, object> arguments);

    参数:

      1.1:exchange:交换机的名称

      1.2:Type:交换机的类型(direct,fanout,topic)

      1.3:durable:如果为true的话,服务器重启后该Exchange保留。(尽设置此项,不能保证重启后消息还在)

      1.4:autoDelete:如果为true的话,当没有消费者的时候,Exchange自动删除。

      1.5:argments:交换机的属性参数

    2:方法BasicQos

    void BasicQos(uint prefetchSize, ushort prefetchCount, bool global);
    

    参数:

      2.1:prefetchsize:prefetchSize maximum amount of content (measured in  octets) that the server will deliver, 0 if unlimited。

      2.2:prefetchCount:prefetchCount maximum number of messages that the server will deliver, 0 if unlimited。一次推给一个消费者的消息数不会超过设置的数。一单超过。消费者将阻塞,一直等到有消息确认ACK

      2.3:global:global true if the settings should be applied to the entire channel rather than each consumer。如果设置为true,则上面的设置会应用于整个Channel,而不是单个的消费者。

     3:方法BasicPublish

    void BasicPublish(string exchange, string routingKey, bool mandatory, IBasicProperties basicProperties, byte[] body);
    

      3.1:exchange:交换机的名称。

      3.2:routingKey:路由键(# 代表匹配0个或者多个单词,*代表匹配一个单词)。

      3.3:mandatory:如果设置为true,如果交换机根据交换机类型和routeKey无法找到一个符合条件的Queue,那么会调用Basic.Return方法将消息返还给生产者。如果设置为false,出现上述情形momBroker会直接将消息扔掉。

      3.4:basicProperties:基本属性:deliveryMode,0:不持久化 1:持久化 (消息的持久化),配合channel(durable=true),queue(durable)可以实现,即使服务器挂掉,消息仍然存在。

      3.5:body:指的是传输的数据。

     4:方法BasicAck

    void BasicAck(ulong deliveryTag, bool multiple);
    

      4.1:deliveryTag:消息的Tag。

      4.2:multiple:如果设置为true,则将小于tag的消息一次性Ack。

    5:方法BasicNack

    void BasicNack(ulong deliveryTag, bool multiple, bool requeue);
    

      5.1:deliveryTag:消息的Tag。

      5.2:multiple:如果设置为true,则将小于tag的消息一次性NAck。

      5.3:requeue:如果设置为true,则被Nack的信息重新入队列。

    6:方法BasicReject

    void BasicReject(ulong deliveryTag, bool requeue);
    

      6.1:deliveryTag:消息的Tag。

      6.2:requeue:如果设置为true,则被拒绝的信息重新入队列。

    7:方法BasicConsume

    string BasicConsume(string queue, bool noAck, string consumerTag,  IDictionary<string, object> arguments, IBasicConsumer consumer);
    

    剩下的有时间再写吧。。。。。

  • 相关阅读:
    Java菜鸟学习笔记(3)--Java API 文档下载与文档注释的使用
    常用控制台命令大全-Ubuntu篇
    Java菜鸟学习笔记(2)--Ubuntu JDK环境变量配置与常见问题
    Java菜鸟学习笔记(1)--Windows JDK环境变量配置与常见问题
    Java菜鸟学习笔记(x)-《java学习圣经宝典》笔记
    自我管理&时间管理(转)
    方滨兴校长在2013届本科生毕业典礼上的讲话(转)
    static Map的使用
    好的测试网站
    经典css网站
  • 原文地址:https://www.cnblogs.com/localhost2016/p/8882582.html
Copyright © 2011-2022 走看看