Exemple #1
0
        protected override void InitializeFrom(BindingElement bindingElement)
        {
            base.InitializeFrom(bindingElement);

            if (bindingElement == null)
            {
                throw new ArgumentNullException("bindingElement");
            }

            RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;

            if (rabbind == null)
            {
                throw new ArgumentException(
                          string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                                        typeof(RabbitMQBinding).AssemblyQualifiedName,
                                        bindingElement.GetType().AssemblyQualifiedName));
            }

            PersistentDelivery = rabbind.PersistentDelivery;
            AutoBindExchange   = rabbind.AutoBindExchange;
            TTL             = rabbind.TTL;
            ProtocolVersion = rabbind.BrokerProtocol.ApiName;
            ReplyToQueue    = rabbind.ReplyToQueue;
            ReplyToExchange = rabbind.ReplyToExchange.ToString();
            OneWayOnly      = rabbind.OneWayOnly;
            MessageFormat   = rabbind.MessageFormat;
            ApplicationId   = rabbind.ApplicationId;
            HeaderNamespace = rabbind.HeaderNamespace;
        }
Exemple #2
0
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);
            if (bindingElement == null)
            {
                throw new ArgumentNullException("bindingElement");
            }

            RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;

            if (rabbind == null)
            {
                throw new ArgumentException(
                          string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                                        typeof(RabbitMQBinding).AssemblyQualifiedName,
                                        bindingElement.GetType().AssemblyQualifiedName));
            }

            rabbind.PersistentDelivery = PersistentDelivery;
            rabbind.AutoBindExchange   = AutoBindExchange;
            rabbind.TTL                      = TTL;
            rabbind.AutoDelete               = AutoDelete;
            rabbind.BrokerProtocol           = Protocol;
            rabbind.TransactedReceiveEnabled = ExactlyOnce;
            rabbind.ReplyToQueue             = ReplyToQueue;
            rabbind.ReplyToExchange          = ReplyToExchange != null ? new Uri(ReplyToExchange) : null;
            rabbind.OneWayOnly               = OneWayOnly;
            rabbind.MessageFormat            = MessageFormat;
        }
Exemple #3
0
        public RabbitMQTransportOutputChannel(BindingContext context, EndpointAddress address, Uri via)
            : base(context, address, via)
        {
            _bindingElement = context.Binding.Elements.Find <RabbitMQTransportBindingElement>();

            MessageEncodingBindingElement encoderElement;

            if (_bindingElement.MessageFormat == MessageFormat.MTOM)
            {
                encoderElement = context.Binding.Elements.Find <MtomMessageEncodingBindingElement>();
            }
            else if (_bindingElement.MessageFormat == MessageFormat.NetBinary)
            {
                encoderElement = context.Binding.Elements.Find <BinaryMessageEncodingBindingElement>();
            }
            else
            {
                encoderElement = context.Binding.Elements.Find <TextMessageEncodingBindingElement>();
            }

            if (encoderElement != null)
            {
                _encoder = encoderElement.CreateMessageEncoderFactory().Encoder;
            }

            _messageProcessor = context.BindingParameters.Find <IFaultMessageProcessor>();
        }
Exemple #4
0
 protected RabbitMQChannelListenerBase(BindingContext context, Uri listenUri)
 {
     _context              = context;
     _listenUri            = listenUri;
     _bindingElement       = context.Binding.Elements.Find <RabbitMQTransportBindingElement>();
     _closeMethod          = OnClose;
     _openMethod           = OnOpen;
     _waitForChannelMethod = OnWaitForChannel;
     _acceptChannelMethod  = OnAcceptChannel;
 }
Exemple #5
0
        private void Initialize()
        {
            lock (this)
            {
                if (!_isInitialized)
                {
                    _transport      = new RabbitMQTransportBindingElement();
                    _textEncoding   = new TextMessageEncodingBindingElement();
                    _mtomEncoding   = new MtomMessageEncodingBindingElement();
                    _binaryEncoding = new BinaryMessageEncodingBindingElement();

                    _duplex = new CompositeDuplexBindingElement();

                    _isInitialized = true;
                }
            }
        }
Exemple #6
0
 private RabbitMQTransportBindingElement(RabbitMQTransportBindingElement other)
 {
     BrokerProtocol           = other.BrokerProtocol;
     MaxReceivedMessageSize   = other.MaxReceivedMessageSize;
     TransactedReceiveEnabled = other.TransactedReceiveEnabled;
     TTL                = other.TTL;
     AutoDelete         = other.AutoDelete;
     PersistentDelivery = other.PersistentDelivery;
     AutoBindExchange   = other.AutoBindExchange;
     ReplyToQueue       = other.ReplyToQueue;
     ReplyToExchange    = other.ReplyToExchange;
     OneWayOnly         = other.OneWayOnly;
     ApplicationId      = other.ApplicationId;
     MessageFormat      = other.MessageFormat;
     HeaderNamespace    = other.HeaderNamespace;
     Immediate          = other.Immediate;
     Mandatory          = other.Mandatory;
 }
        public RabbitMQTransportInputChannel(BindingContext context, EndpointAddress address, string bindToExchange) : base(context, address)
        {
            _bindToExchange = bindToExchange;
            _bindingElement = context.Binding.Elements.Find <RabbitMQTransportBindingElement>();

            IEnumerable <MessageEncodingBindingElement> encoderElemements = context.BindingParameters.FindAll <MessageEncodingBindingElement>();

            foreach (MessageEncodingBindingElement encoderElem in encoderElemements)
            {
                MessageEncoder encoder = encoderElem.CreateMessageEncoderFactory().Encoder;

                if (encoder.ContentType == null)
                {
                    continue;
                }

                _encoders.Add(encoder.ContentType, encoder);
            }
        }