public Writer(IDuplexChannel<Message> channel) { Channel = channel; Id = Guid.NewGuid(); SequenceNumber = new SequenceNumber(); }
public void Reply (IDuplexChannel channel, bool useTimeout) { EventsHandler.BeforeSendReply (); if (useTimeout && Operation.Parent.ChannelDispatcher != null) // FIXME: this condition is a workaround for NRE, there might be better way to get timeout value. channel.Send (ReplyMessage, Operation.Parent.ChannelDispatcher.timeouts.SendTimeout); else channel.Send (ReplyMessage); }
public void Reply (IDuplexChannel channel, bool useTimeout) { EventsHandler.BeforeSendReply (); if (useTimeout) channel.Send (ReplyMessage, Operation.Parent.ChannelDispatcher.timeouts.SendTimeout); else channel.Send (ReplyMessage); }
public IChannelBinder Accept(TimeSpan timeout) { IDuplexChannel channel = this.listener.AcceptChannel(timeout); if (channel == null) { return(null); } return(new DuplexChannelBinder(channel, this.correlator, this.listener.Uri)); }
public async Task <IChannelBinder> AcceptAsync(CancellationToken token) { IDuplexChannel channel = await listener.AcceptChannelAsync(token); if (channel == null) { return(null); } return(null); //return new DuplexChannelBinder(channel, correlator, listener.Uri); }
public IChannelBinder EndAccept(IAsyncResult result) { IDuplexChannel channel = this.listener.EndAcceptChannel(result); if (channel == null) { return(null); } return(new DuplexChannelBinder(channel, this.correlator, this.listener.Uri)); }
public void Reply(IDuplexChannel channel, bool useTimeout) { EventsHandler.BeforeSendReply(); if (useTimeout) { channel.Send(ReplyMessage, Operation.Parent.ChannelDispatcher.timeouts.SendTimeout); } else { channel.Send(ReplyMessage); } }
public void Reply(IDuplexChannel channel, bool useTimeout) { EventsHandler.BeforeSendReply(); if (useTimeout && Operation.Parent.ChannelDispatcher != null) // FIXME: this condition is a workaround for NRE, there might be better way to get timeout value. { channel.Send(ReplyMessage, Operation.Parent.ChannelDispatcher.timeouts.SendTimeout); } else { channel.Send(ReplyMessage); } }
/// <summary> /// Initializes a new instance of the DuplexRequestContext class /// </summary> /// <param name="request">request message</param> /// <param name="defaultTimeouts">default timeouts</param> /// <param name="innerChannel">inner channel</param> /// <param name="observer">indicating the broker observer</param> /// <param name="client">indicating the broker client</param> public DuplexRequestContext(Message request, IDefaultCommunicationTimeouts defaultTimeouts, IDuplexChannel innerChannel, BrokerObserver observer, BrokerClient client) : base(request.Version, client) { this.defaultTimeouts = defaultTimeouts; this.innerChannel = innerChannel; this.observer = observer; if (request != null) { this.messageId = request.Headers.MessageId; this.replyTo = request.Headers.ReplyTo; } }
public DurableInstanceContextDuplexChannel(ChannelManagerBase channelManger, ContextType contextType, IDuplexChannel innerChannel, string contextStoreLocation) : base(channelManger, innerChannel) { this.contextType = contextType; this.outputChannel = new DurableInstanceContextOutputChannel(channelManger, contextType, (IOutputChannel)innerChannel, contextStoreLocation); this.inputChannel = new DurableInstanceContextInputChannel(channelManger, contextType, (IInputChannel)innerChannel); }
public MainWindow() { InitializeComponent(); try { binding = new NetTcpBinding(); //创建绑定 factory = binding.BuildChannelFactory <IDuplexChannel>(new BindingParameterCollection()); factory.Open(); //打开通道工厂 //再这里创建IRequestChannel duplexChannel = factory.CreateChannel(new EndpointAddress("net.tcp://localhost:9090/DuplexService/Pouint2")); duplexChannel.Open(); //打开通道 } catch (Exception ex) { } }
public CompactSignatureSecurityDuplexChannel( ChannelManagerBase channelManager, IDuplexChannel innerChannel, DiscoveryVersion discoveryVersion, X509Certificate2 certificate, ReceivedCertificatesStoreSettings receivedCertificatesStoreSettings) : base(channelManager) { Utility.IfNullThrowNullArgumentException(innerChannel, "innerChannel"); this.DiscoveryInfo = new ProtocolSettings(discoveryVersion); this.InnerChannel = innerChannel; this.ReceivedCertificatesStoreSettings = receivedCertificatesStoreSettings; this.SigningCertificate = certificate; this.onInnerChannelFaulted = new EventHandler(OnInnerChannelFaulted); this.InnerChannel.Faulted += this.onInnerChannelFaulted; }
internal void Init(IDuplexChannel channel, IRequestReplyCorrelator correlator, Uri listenUri) { if (initialized) { Fx.Assert(this.channel == channel, "Wrong channel when calling Init"); Fx.Assert(this.correlator == correlator, "Wrong channel when calling Init"); Fx.Assert(this.listenUri == listenUri, "Wrong listenUri when calling Init"); return; } Fx.Assert(channel != null, "caller must verify"); Fx.Assert(correlator != null, "caller must verify"); this.channel = channel; this.listenUri = listenUri; this.channel.Faulted += new EventHandler(OnFaulted); initialized = true; }
bool CompleteAccept(IAsyncResult result) { try { Socket dataSocket = this.listener.listenSocket.EndAccept(result); this.channel = new SizedTcpDuplexServerChannel( this.listener.encoderFactory.Encoder, this.listener.bufferManager, new EndpointAddress(this.listener.uri), dataSocket, this.listener); } catch (ObjectDisposedException) { this.channel = null; } return(true); }
/// <summary> /// Fecha um wcf channel associado a uma instancia de servico /// </summary> /// <param name="servico">instancia de um objeto criado anteriormente com Ativador.Get()</param> public static void AbortChannel(object servico) { try { if (servico == null) { logger.Error("Erro em Ativador.AbortChannel(): Parametro nao pode ser nulo"); return; } IDuplexChannel channel2 = servico as IDuplexChannel; if (channel2 != null) { logger.Info("Abort duplex channel for: " + servico.ToString()); channel2.Close(); } else { IChannel channel = servico as IChannel; if (channel != null) { logger.Info("Abort channel for: " + servico.ToString()); try { channel.Close(); } catch (Exception ex) { logger.Error("Erro em Ativador.AbortChannel()" + ex.Message, ex); logger.Error("Trying really abort the channel"); channel.Abort(); } } } } catch (Exception ex) { logger.Error("Erro em Ativador.AbortChannel()" + ex.Message, ex); } }
public DuplexOutputChannel(DuplexOneWayChannelFactory factory, IDuplexChannel innerChannel) : base(factory) { this.packetRoutable = factory.packetRoutable; this.innerChannel = innerChannel; }
public OperationInvokerHandler (IChannel channel) { duplex = channel as IDuplexChannel; }
protected override IInputChannel OnEndAcceptChannel(IAsyncResult result) { IDuplexChannel innerChannel = this.innerChannelListener.EndAcceptChannel(result); return(this.WrapInnerChannel(innerChannel)); }
protected override IInputChannel OnAcceptChannel(TimeSpan timeout) { IDuplexChannel innerChannel = this.innerChannelListener.AcceptChannel(timeout); return(this.WrapInnerChannel(innerChannel)); }
protected override IOutputChannel OnCreateChannel(EndpointAddress address, Uri via) { IDuplexChannel channel = this.innnerFactory.CreateChannel(address, via); return(new DuplexOutputChannel(this, channel)); }
public void SetUp() { _subject = new DefaultRequestHandler(); _channel = MockRepository.GenerateMock <IDuplexChannel>(); }
protected override bool HasSecuritySession(IDuplexChannel channel) { return(false); }
public RemoteExecutor(IDuplexChannel channel, IMessageDispatcher dispatcher, IMessageFactory messageFactory) { _channel = channel; _dispatcher = dispatcher; _messageFactory = messageFactory; }
public void AssociateWith(string channelName) { var networkStream = RegisterChannel(channelName); AssociatedChannel = new DuplexHermesChannel(channelName, networkStream); }
public DuplexRequestContext(Message request, IDefaultCommunicationTimeouts defaultTimeouts, IDuplexChannel innerChannel) { this.request = request; this.defaultTimeouts = defaultTimeouts; this.innerChannel = innerChannel; if (request != null) { this.replyTo = request.Headers.ReplyTo; } this.thisLock = new object(); }
public DuplexChannelWrapper(ChannelManagerBase channelManager, IDuplexChannel innerChannel) : base(channelManager, innerChannel.LocalAddress) { this.innerChannel = innerChannel; }
public OperationInvokerHandler(IChannel channel) { duplex = channel as IDuplexChannel; }
public ClientDuplexReceiveMessageAndVerifySecurityAsyncResult(SecurityChannelFactory <TChannel> .SecurityDuplexChannel channel, IDuplexChannel innerChannel, TimeSpan timeout, AsyncCallback callback, object state) : base(innerChannel, timeout, callback, state) { this.channel = channel; }
internal DuplexRequestContext(IDuplexChannel channel, Message request, IDefaultCommunicationTimeouts timeouts) : base(request, timeouts.CloseTimeout, timeouts.SendTimeout) { this.channel = channel; }
/// <summary> /// Initializes a new instance of the DuplexRequestContext class /// </summary> /// <param name="request">request message</param> /// <param name="defaultTimeouts">default timeouts</param> /// <param name="innerChannel">inner channel</param> /// <param name="observer">indicating the broker observer</param> public DuplexRequestContext(Message request, IDefaultCommunicationTimeouts defaultTimeouts, IDuplexChannel innerChannel, BrokerObserver observer) : this(request, defaultTimeouts, innerChannel, observer, null) { }
public SecurityDuplexChannel(ChannelManagerBase factory, SecurityProtocolFactory securityProtocolFactory, IDuplexChannel innerChannel, EndpointAddress to, Uri via) : base(factory, securityProtocolFactory, innerChannel, to, via) { }
protected override IAsyncResult BeginTryReceiveItem(IDuplexChannel channel, AsyncCallback callback, object state) { return(channel.BeginTryReceive(TimeSpan.MaxValue, callback, state)); }
internal DuplexRequestContext(IDuplexChannel channel, Message request, DuplexChannelBinder binder) : base(request, binder.DefaultCloseTimeout, binder.DefaultSendTimeout) { _channel = channel; _binder = binder; }
protected override void EndTryReceiveItem(IDuplexChannel channel, IAsyncResult result, out Message item) { channel.EndTryReceive(result, out item); }