/// <summary> /// 消费者,一个完全自定义的消费者 /// </summary> /// <param name="exchange">exchange</param> /// <param name="queueName">queueName</param> /// <param name="autoDelete">autoDelete</param> /// <param name="_objCtx"></param> public FanoutConsumer(string exchange, string queueName, bool autoDelete, object _objCtx = null) : base(new MQueue() { AutoDeclare = false, AutoDelete = autoDelete, Durable = true, Exchange = new Exchange() { AutoDeclare = false, AutoDelete = false, Durable = true, ExchangeType = ExchangeType.Fanout, ExchangeName = exchange, }, Exclusive = false, QueueName = queueName, RouteKey = "", Host = MQHostConfigManager.GetDefaultHost(), }, _objCtx) { }
/// <summary> /// Initializes a new instance of the <see cref="DefaultConsumer{M}"/> class. /// 消费者,一个完全自定义的消费者 /// </summary> /// <param name="exchange">exchange</param> /// <param name="routeKey">routeKey</param> /// <param name="queueName">queueName</param> /// <param name="autoDelete">autoDelete</param> public DefaultConsumer(string exchange, string routeKey, string queueName, bool autoDelete) : base(new MQueue() { AutoDeclare = false, AutoDelete = autoDelete, Durable = true, Exchange = new Exchange() { AutoDeclare = false, AutoDelete = false, Durable = true, ExchangeType = ExchangeType.Direct, ExchangeName = exchange, }, Exclusive = false, QueueName = queueName, RouteKey = routeKey, Host = MQHostConfigManager.GetDefaultHost(), }) { }
/// <summary> /// Initializes a new instance of the <see cref="FanoutPublisher{TM}"/> class. /// 消息发布者 非默认,一个自定义的消息交换机、队列、路由key /// </summary> /// <param name="msg">消息</param> /// <param name="exchange">交换机</param> /// <param name="queueName">队列</param> /// <param name="autoDelete">是否自动删除</param> public FanoutPublisher(TM msg, string exchange, string queueName, bool autoDelete) : base( mq: new MQueue() { AutoDeclare = false, AutoDelete = autoDelete, Durable = true, Exchange = new Exchange() { AutoDeclare = false, AutoDelete = false, Durable = true, ExchangeType = ExchangeType.Fanout, ExchangeName = exchange, }, Exclusive = false, QueueName = queueName, Host = MQHostConfigManager.GetDefaultHost(), }, msg: msg) { }