示例#1
0
        public RabbitExchange(IModel model, IRabbitSerializer serializer,
                              string name, bool canDestroy, ExchangeOptions options)
        {
            this.Name = name;

            _model             = model;
            _defaultSerializer = serializer;
            _canDestroy        = canDestroy;
            _options           = options;
            _isDefaultExchange = name == string.Empty;

            _rpcHelper = new RpcHelper(_model, this.Name, serializer);
        }
        public IRabbitExchange DeclareExchangeNoWait(string name, ExchangeOptions options)
        {
            Argument.NotNullOrEmpty(name, "name");

            EnsureNotDisposed();

            lock (_model)
            {
                _model.ExchangeDeclareNoWait(name, options.ToExchangeType(), options.Durable, options.AutoDelete, options.Arguments);
            }

            return(new RabbitExchange(_model, _defaultSerializer, name, true, options));
        }
		public IRabbitExchange DeclareExchangeNoWait(string	name, ExchangeOptions options)
		{
			Argument.NotNullOrEmpty(name, "name");

			EnsureNotDisposed();

			lock (_model)
			{
				_model.ExchangeDeclareNoWait(name, options.ToExchangeType(), options.Durable, options.AutoDelete, options.Arguments);
			}

			return new RabbitExchange(_model, _defaultSerializer, name,	true, options);
		}
示例#4
0
        public static string ToExchangeType(this ExchangeOptions source)
        {
            if (source.ExchangeType == RabbitExchangeType.Custom)
            {
                if (string.IsNullOrEmpty(source.CustomExchangeType))
                {
                    throw new ArgumentException("If the exchange type is set to 'Custom' you must provide its type in the property CustomExchangeType");
                }

                return(source.CustomExchangeType);
            }

            return(source.ExchangeType.ToString().ToLowerInvariant());
        }
 protected bool Equals(ExchangeOptions other)
 {
     return(ExchangeType == other.ExchangeType && string.Equals(CustomExchangeType, other.CustomExchangeType) && Durable == other.Durable && AutoDelete == other.AutoDelete);
 }