コード例 #1
0
        protected ServiceBusChannelListener(BindingContext context, NetMessagingTransportBindingElement transport) : base(context.Binding)
        {
            this.listenUri = context.ListenUriBaseAddress;
            if (!string.IsNullOrEmpty(context.ListenUriRelativeAddress))
            {
                this.listenUri = new System.Uri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);
            }
            this.MaxBufferSize         = (int)Math.Min(transport.MaxReceivedMessageSize, (long)2147483647);
            this.ReceiveContextEnabled = transport.ReceiveContextEnabled;
            MessageEncodingBindingElement messageEncodingBindingElement = context.BindingParameters.Find <MessageEncodingBindingElement>();

            if (messageEncodingBindingElement == null)
            {
                messageEncodingBindingElement = Microsoft.ServiceBus.Messaging.Channels.TransportDefaults.CreateDefaultEncoder();
            }
            this.MessageEncoderFactory    = messageEncodingBindingElement.CreateMessageEncoderFactory();
            this.MessagingFactorySettings = transport.CreateMessagingFactorySettings(context);
            this.MessagingAddress         = new Microsoft.ServiceBus.Messaging.MessagingAddress(this.Uri, this.MessagingFactorySettings.NetMessagingTransportSettings.GatewayMode);
            if (this.MessagingAddress.Type != MessagingAddressType.Entity)
            {
                throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.Argument("ListenUriBaseAddress", SRClient.EntityNameNotFound(this.MessagingAddress.ToString()));
            }
            this.TransportBindingElement = transport;
            this.PrefetchCount           = transport.PrefetchCount;
        }
コード例 #2
0
        public ServiceBusChannelFactory(BindingContext context, NetMessagingTransportBindingElement transport) : base(context.Binding)
        {
            this.MessagingFactorySettings = transport.CreateMessagingFactorySettings(context);
            this.ManualAddressing         = transport.ManualAddressing;
            this.MaxBufferPoolSize        = transport.MaxBufferPoolSize;
            this.MaxBufferSize            = (int)Math.Min(transport.MaxReceivedMessageSize, (long)2147483647);
            MessageEncodingBindingElement messageEncodingBindingElement = context.BindingParameters.Find <MessageEncodingBindingElement>();

            if (messageEncodingBindingElement == null)
            {
                messageEncodingBindingElement = Microsoft.ServiceBus.Messaging.Channels.TransportDefaults.CreateDefaultEncoder();
            }
            this.MessageEncoderFactory = messageEncodingBindingElement.CreateMessageEncoderFactory();
        }