Пример #1
0
        /// <summary>
        /// When overridden in a derived class, returns a custom binding element object.
        /// </summary>
        /// <returns>
        /// A custom <see cref="T:System.ServiceModel.Channels.BindingElement" /> object.
        /// </returns>
        protected override BindingElement CreateBindingElement()
        {
            NmsTransportBindingElement bindingElement = new NmsTransportBindingElement();

            this.ApplyConfiguration(bindingElement);
            return(bindingElement);
        }
Пример #2
0
        /// <summary>
        /// Applies the content of a specified binding element to this binding configuration element.
        /// </summary>
        /// <param name="bindingElement">A binding element.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///     <paramref name="transportElement"/> is null.</exception>
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);

            NmsTransportBindingElement nmsBindingElement = (NmsTransportBindingElement)bindingElement;

            nmsBindingElement.Destination     = Destination;
            nmsBindingElement.DestinationType = DestinationType;
        }
Пример #3
0
        /// <summary>
        /// Initializes this binding configuration section with the content of the specified binding element.
        /// </summary>
        /// <param name="bindingElement">A binding element.</param>
        protected override void InitializeFrom(BindingElement bindingElement)
        {
            base.InitializeFrom(bindingElement);

            NmsTransportBindingElement nmsBindingElement = (NmsTransportBindingElement)bindingElement;

            Destination     = nmsBindingElement.Destination;
            DestinationType = nmsBindingElement.DestinationType;
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NmsInputChannelListener"/> class.
        /// </summary>
        /// <param name="transportElement">The binding element.</param>
        /// <param name="context">The context.</param>
        internal NmsInputChannelListener(NmsTransportBindingElement transportElement, BindingContext context)
            : base(context.Binding)
        {
            _bufferManager = BufferManager.CreateBufferManager(transportElement.MaxBufferPoolSize, (int)transportElement.MaxReceivedMessageSize);

            MessageEncodingBindingElement messageEncoderBindingElement = context.BindingParameters.Remove <MessageEncodingBindingElement>();

            _messageEncoderFactory = (messageEncoderBindingElement != null)
                                ? messageEncoderBindingElement.CreateMessageEncoderFactory()
                                : NmsConstants.DefaultMessageEncoderFactory;

            _channelQueue       = new InputQueue <IInputChannel>();
            _currentChannelLock = new object();
            _destinationName    = transportElement.Destination;
            _destinationType    = transportElement.DestinationType;
            _uri = new Uri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);
            Tracer.DebugFormat("Listening to {0} at {1}/{2}", _destinationType, _uri, _destinationName);
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NmsChannelFactory&lt;TChannel&gt;"/> class.
        /// </summary>
        /// <param name="bindingElement">The binding element.</param>
        /// <param name="context">The context.</param>
        internal NmsChannelFactory(NmsTransportBindingElement bindingElement, BindingContext context)
            : base(context.Binding)
        {
            _bindingElement = bindingElement;

            Collection <MessageEncodingBindingElement> messageEncoderBindingElements = context.BindingParameters.FindAll <MessageEncodingBindingElement>();

            if (messageEncoderBindingElements.Count > 1)
            {
                throw new InvalidOperationException("More than one MessageEncodingBindingElement was found in the BindingParameters of the BindingContext");
            }
            _encoderFactory = (messageEncoderBindingElements.Count == 0)
                                ? NmsConstants.DefaultMessageEncoderFactory
                                : messageEncoderBindingElements[0].CreateMessageEncoderFactory();

            _bufferManager   = BufferManager.CreateBufferManager(bindingElement.MaxBufferPoolSize, Int32.MaxValue);
            _destination     = bindingElement.Destination;
            _destinationType = bindingElement.DestinationType;

            Tracer.DebugFormat("Destination ({0}) : {1}", _destinationType, _destination);
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NmsBinding"/> class.
 /// </summary>
 /// <remarks>
 /// The default transport is set to <see cref="NmsTransportBindingElement" />, while the
 /// default message encoding is set to <see cref="TextMessageEncodingBindingElement" />.
 /// </remarks>
 public NmsBinding()
 {
     _messageElement   = new TextMessageEncodingBindingElement();
     _transportElement = new NmsTransportBindingElement();
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NmsTransportBindingElement"/> class.
 /// </summary>
 /// <param name="element">The element.</param>
 protected NmsTransportBindingElement(NmsTransportBindingElement element)
 {
     ManualAddressing = element.ManualAddressing;
     Destination      = element.Destination;
     DestinationType  = element.DestinationType;
 }