public RelayHttpTransportChannelListener(BindingContext context, MessageEncodingBindingElement encodingBindingElement, IChannelListener <IReplyChannel> innerChannelListener) : base(context.Binding, innerChannelListener) { this.innerChannelListener = innerChannelListener; this.listenUri = this.innerChannelListener.Uri; this.encoder = encodingBindingElement.CreateMessageEncoderFactory().Encoder; this.preserveRawHttp = context.BindingParameters.Find <NameSettings>().ServiceSettings.PreserveRawHttp; }
private bool hostStarted; // Indicates whether call to ChannelHost.Start() is current //--------------------------------------------------------------------- // Implementation /// <summary> /// Constructor. /// </summary> /// <param name="context">The <see cref="BindingContext" /> holding the information necessary to construct the channel stack.</param> /// <exception cref="InvalidOperationException">Thrown if problems were found with the binding parameters.</exception> internal LillTekChannelListener(BindingContext context) { this.maxAcceptedChannels = ServiceModelHelper.MaxAcceptedChannels; // $todo(jeff.lill): Hardcoded bkTaskInterval = ServiceModelHelper.DefaultBkTaskInterval; // This too this.context = context; this.uri = GetListenUri(context); this.ep = ServiceModelHelper.ToMsgEP(uri); this.onBkTask = new AsyncCallback(OnBkTask); this.sessionMode = false; this.hostStarted = false; // Initialize the message encoder factory from the binding context if // one was specified. Use the binary message encoding factory otherwise. if (context.BindingParameters.FindAll <MessageEncodingBindingElement>().Count > 1) { throw new InvalidOperationException("Multiple MessageEncodingBindingElements were found in the BindingParameters of the BindingContext."); } MessageEncodingBindingElement element = context.BindingParameters.Find <MessageEncodingBindingElement>(); if (element != null) { messageEncoderFactory = element.CreateMessageEncoderFactory(); } else { messageEncoderFactory = new BinaryMessageEncodingBindingElement().CreateMessageEncoderFactory(); } }
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; }
private bool hostStarted; // Indicates whether call to ChannelHost.Start() is current /// <summary> /// Constructor. /// </summary> /// <param name="context">The <see cref="BindingContext" />.</param> /// <exception cref="InvalidOperationException">Thrown if problems were found with the binding parameters.</exception> public LillTekChannelFactory(BindingContext context) : base() { this.channels = new Dictionary <string, TInternal>(); this.hostStarted = false; // Initialize the message encoder factory from the binding context if // one was specified. Use the binary message encoding factory otherwise. if (context.BindingParameters.FindAll <MessageEncodingBindingElement>().Count > 1) { throw new InvalidOperationException("Multiple MessageEncodingBindingElements were found in the BindingParameters of the BindingContext."); } MessageEncodingBindingElement element = context.BindingParameters.Find <MessageEncodingBindingElement>(); if (element != null) { messageEncoderFactory = element.CreateMessageEncoderFactory(); } else { messageEncoderFactory = new BinaryMessageEncodingBindingElement().CreateMessageEncoderFactory(); } }
public RabbitMQOutputChannel(BindingContext context, IModel model, EndpointAddress address) : base(context, address) { m_bindingElement = context.Binding.Elements.Find <RabbitMQTransportBindingElement>(); MessageEncodingBindingElement encoderElement = context.Binding.Elements.Find <MessageEncodingBindingElement>(); if (encoderElement != null) { m_encoder = encoderElement.CreateMessageEncoderFactory().Encoder; } m_model = model; }
public RabbitMQOutputChannel(BindingContext bindingContext, IModel model, EndpointAddress endpointAddress) : base(bindingContext, endpointAddress) { this._bindingElement = bindingContext.Binding.Elements.Find <RabbitMQTransportBindingElement>(); this._model = model; MessageEncodingBindingElement encoderElement = bindingContext.Binding.Elements.Find <MessageEncodingBindingElement>(); if (encoderElement != null) { MessageEncoderFactory encoderFactory = encoderElement.CreateMessageEncoderFactory(); this._encoder = encoderFactory.Encoder; } }
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(); }
protected ZMQChannelBase(ChannelManagerBase channelManager, BindingContext context, Socket socket, SocketMode socketMode) : base(channelManager) { MessageEncodingBindingElement encoderElem = context.BindingParameters.Find <MessageEncodingBindingElement>(); _encoder = encoderElem.CreateMessageEncoderFactory().Encoder; _context = context; _socket = socket; _socketMode = socketMode; _onSendHandler = Send; _bufferManager = context.BindingParameters.Find <BufferManager>(); }
private static HandshakeDelegate BuildHandshakeDelegateForDispatcher(IServiceDispatcher dispatcher) { BindingElementCollection be = dispatcher.Binding.CreateBindingElements(); MessageEncodingBindingElement mebe = be.Find <MessageEncodingBindingElement>(); MessageEncoderFactory mefact = mebe.CreateMessageEncoderFactory(); ConnectionOrientedTransportBindingElement tbe = be.Find <ConnectionOrientedTransportBindingElement>(); int maxReceivedMessageSize = (int)Math.Min(tbe.MaxReceivedMessageSize, int.MaxValue); int maxBufferSize = tbe.MaxBufferSize; var bufferManager = BufferManager.CreateBufferManager(tbe.MaxBufferPoolSize, maxReceivedMessageSize); int connectionBufferSize = tbe.ConnectionBufferSize; TransferMode transferMode = tbe.TransferMode; var upgradeBindingElements = (from element in be where element is StreamUpgradeBindingElement select element).Cast <StreamUpgradeBindingElement>().ToList(); StreamUpgradeProvider streamUpgradeProvider = null; ISecurityCapabilities securityCapabilities = null; if (upgradeBindingElements.Count > 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.MultipleStreamUpgradeProvidersInParameters)); } // TODO: Limit NamedPipes to prevent it using SslStreamSecurityUpgradeProvider else if ((upgradeBindingElements.Count == 1) /*&& this.SupportsUpgrade(upgradeBindingElements[0])*/) { SecurityCredentialsManager credentialsManager = dispatcher.Host.Description.Behaviors.Find <SecurityCredentialsManager>(); var bindingContext = new BindingContext(new CustomBinding(dispatcher.Binding), new BindingParameterCollection()); if (credentialsManager != null) { bindingContext.BindingParameters.Add(credentialsManager); } streamUpgradeProvider = upgradeBindingElements[0].BuildServerStreamUpgradeProvider(bindingContext); streamUpgradeProvider.OpenAsync().GetAwaiter().GetResult(); securityCapabilities = upgradeBindingElements[0].GetProperty <ISecurityCapabilities>(bindingContext); } return((connection) => { connection.MessageEncoderFactory = mefact; connection.StreamUpgradeAcceptor = streamUpgradeProvider?.CreateUpgradeAcceptor(); connection.SecurityCapabilities = securityCapabilities; connection.ServiceDispatcher = dispatcher; connection.BufferManager = bufferManager; connection.MaxReceivedMessageSize = maxReceivedMessageSize; connection.MaxBufferSize = maxBufferSize; connection.ConnectionBufferSize = connectionBufferSize; connection.TransferMode = transferMode; return Task.CompletedTask; }); }
/// <summary> /// Constructor for request factory. /// </summary> /// <param name="transportElement"></param> /// <param name="context"></param> public SerialRequestChannelFactory( SerialTransportBindingElement transportElement, BindingContext context) : base(context.Binding) { MessageEncodingBindingElement messageEncodingElement = context.RemainingBindingElements.Remove <MessageEncodingBindingElement>(); this.bufferManager = BufferManager.CreateBufferManager( transportElement.MaxBufferPoolSize, 0x400000); //4MB this.encoderFactory = messageEncodingElement.CreateMessageEncoderFactory(); MaxReceivedMessageSize = transportElement.MaxReceivedMessageSize; this.PortNumber = transportElement.FactoryPort; }
internal MessageEncoder CreateEncoder <TChannel>(MessageEncodingBindingElement mbe) { var f = mbe.CreateMessageEncoderFactory(); var t = typeof(TChannel); if (t == typeof(IRequestSessionChannel) || #if !NET_2_1 t == typeof(IReplySessionChannel) || #endif t == typeof(IInputSessionChannel) || t == typeof(IOutputSessionChannel) || t == typeof(IDuplexSessionChannel)) { return(f.CreateSessionEncoder()); } else { return(f.Encoder); } }
/// <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); }
internal UdpChannelListener(UdpTransportBindingElement bindingElement, BindingContext context) : base(context.Binding) { this.maxMessageSize = (int)bindingElement.MaxReceivedMessageSize; this.multicast = bindingElement.Multicast; this.bufferManager = BufferManager.CreateBufferManager(bindingElement.MaxBufferPoolSize, this.maxMessageSize); this.maxBufferPoolSize = bindingElement.MaxBufferPoolSize; MessageEncodingBindingElement messageEncoderBindingElement = context.BindingParameters.Remove <MessageEncodingBindingElement>(); if (messageEncoderBindingElement != null) { this.messageEncoderFactory = messageEncoderBindingElement.CreateMessageEncoderFactory(); } else { this.messageEncoderFactory = UdpConstants.DefaultMessageEncoderFactory; } this.channelQueue = new InputQueue <IInputChannel>(); this.currentChannelLock = new object(); Uri baseAddress = context.ListenUriBaseAddress; if (baseAddress == null) { if (context.ListenUriMode == ListenUriMode.Unique) { UriBuilder uriBuilder = new UriBuilder(this.Scheme, Dns.GetHostEntry(String.Empty).HostName); uriBuilder.Path = Guid.NewGuid().ToString(); baseAddress = uriBuilder.Uri; } else { throw new InvalidOperationException( "Null is only a supported value for ListenUriBaseAddress when using ListenUriMode.Unique."); } } this.InitializeUri(baseAddress, context.ListenUriRelativeAddress, context.ListenUriMode); }
public void MessageEncoding() { BasicHttpBinding b = new BasicHttpBinding(); foreach (BindingElement be in b.CreateBindingElements()) { MessageEncodingBindingElement mbe = be as MessageEncodingBindingElement; if (mbe != null) { MessageEncoderFactory f = mbe.CreateMessageEncoderFactory(); MessageEncoder e = f.Encoder; Assert.AreEqual(typeof(TextMessageEncodingBindingElement), mbe.GetType(), "#1-1"); Assert.AreEqual(MessageVersion.Soap11, f.MessageVersion, "#2-1"); Assert.AreEqual("text/xml; charset=utf-8", e.ContentType, "#3-1"); Assert.AreEqual("text/xml", e.MediaType, "#3-2"); return; } } Assert.Fail("No message encodiing binding element."); }
public void DefaultMessageEncoding() { WSHttpBinding b = new WSHttpBinding(); foreach (BindingElement be in b.CreateBindingElements()) { MessageEncodingBindingElement mbe = be as MessageEncodingBindingElement; if (mbe == null) { continue; } MessageEncoderFactory f = mbe.CreateMessageEncoderFactory(); MessageEncoder e = f.Encoder; Assert.AreEqual(typeof(TextMessageEncodingBindingElement), mbe.GetType(), "#1-1"); Assert.AreEqual(MessageVersion.Default, f.MessageVersion, "#2-1"); Assert.AreEqual("application/soap+xml; charset=utf-8", e.ContentType, "#3-1"); Assert.AreEqual("application/soap+xml", e.MediaType, "#3-2"); return; } Assert.Fail("No message encodiing binding element."); }
public SsbChannelListener(SsbBindingElement bindingElement, BindingContext context) : base(context.Binding) { this.bindingElement = bindingElement; originalBindingContext = context.Clone(); //Address stuff if (context.ListenUriMode == ListenUriMode.Unique) { throw new ProtocolException("ListenUriMode.Unique is not supported. You must provide an explicit address"); } Uri baseAddress = context.ListenUriBaseAddress; if (baseAddress == null) { throw new ProtocolException("Address is null. You must provide an exlpicit address"); } listenUri = new SsbUri(BuildUri(baseAddress, context.ListenUriRelativeAddress)); //copy properties from binding element // TODO how do we enforce MaxReceivedMessgeSize this.maxMessageSize = (int)bindingElement.MaxReceivedMessageSize; this.connstring = bindingElement.SqlConnectionString; this.bufferManager = BufferManager.CreateBufferManager(bindingElement.MaxBufferPoolSize, this.maxMessageSize); MessageEncodingBindingElement messageEncoderBindingElement = context.BindingParameters.Remove <MessageEncodingBindingElement>(); if (messageEncoderBindingElement != null) { this.messageEncoderFactory = messageEncoderBindingElement.CreateMessageEncoderFactory(); } else { this.messageEncoderFactory = SsbConstants.DefaultMessageEncoderFactory; } }
public override MessageEncoderFactory CreateMessageEncoderFactory() { return(new BankConnectMessageEncoderFactory(innerBindingElement.CreateMessageEncoderFactory())); }
/// <summary> /// Create the CompactMessageEncoderFactory /// </summary> /// <returns></returns> public override MessageEncoderFactory CreateMessageEncoderFactory() { return(new CompactMessageEncoderFactory(_innerBindingElement.CreateMessageEncoderFactory())); }
public override MessageEncoderFactory CreateMessageEncoderFactory() { return(new CustomEncoderFactory(this, innerBindingElement.CreateMessageEncoderFactory())); }
public override MessageEncoderFactory CreateMessageEncoderFactory() { return(new MtomMessageEncoderFactory(_innerEncodingBindingElement.CreateMessageEncoderFactory())); }
//Main entry point into the encoder binding element. Called by WCF to get the factory that will create the //message encoder public override MessageEncoderFactory CreateMessageEncoderFactory() { return(new MyCompressionMessageEncoderFactory(innerBindingElement.CreateMessageEncoderFactory(), this.compressionAlgorithm)); }
public CryptEncoder(MessageEncodingBindingElement ele) { this._inner = ele.CreateMessageEncoderFactory().Encoder; }
//Main entry point into the encoder binding element. Called by WCF to get the factory that will create the //message encoder public override MessageEncoderFactory CreateMessageEncoderFactory() { return(new ExtendedMessageEncoderFactory(innerBindingElement.CreateMessageEncoderFactory(), _encoderType)); }
//Main entry point into the encoder binding element. Called by WCF to get the factory that will create the //message encoder public override MessageEncoderFactory CreateMessageEncoderFactory() { return(new GZipMessageEncoderFactory(InnerMessageEncodingBindingElement.CreateMessageEncoderFactory())); }
/// <summary> /// Ponto de entrada principal para o encoder binding element. /// Chamado pelo WCF para recupera o factory que irá criar o encoder da mensagem. /// </summary> /// <returns></returns> public override MessageEncoderFactory CreateMessageEncoderFactory() { return(new GZipMessageEncoderFactory(_innerBindingElement.CreateMessageEncoderFactory(), _isClient)); }
public override MessageEncoderFactory CreateMessageEncoderFactory() { return(new SmevServiceMessageEncoderFactory("text/xml", "utf-8", _vers, _innerBindingElement.CreateMessageEncoderFactory(), LogPath, SenderActor)); }