public EndpointProxy GetEndpoint(Identity target, string uri, IDictionary <string, object> extras) { EndpointProxy e = this.GetEndpoint(target) ?? this.CreateProxy(); e.Identity = target; // always clear, cached proxy will have broken channel e.Remove(uri); // always reget channel, make sure it's valid IClientChannel channel = this.ChannelSelector.GetChannel(new Uri(uri)); // connect message Message msg = new Message(); msg.MessageType = MessageType.CONNECT; IDictionary <string, object> content = new Dictionary <string, object>(); this.Identity.Render(content); // pass extra data if (extras != null) { foreach (var p in extras) { content.Add(p); } } msg.Content = content; this._handler.SendAndWait(e, channel, msg, TIMEOUT); e.Add(channel); return(e); }
private EndpointProxy CreateProxy() { EndpointProxy e = new EndpointProxy(this._handler); this._connected.Add(e); return(e); }
internal IDictionary <string, object> SendAndWait(EndpointProxy e , IChannelSender sender , Message message , int timeout) { SendCallback callback = new SendCallback(e); this.Send(message, sender, callback); callback.WaitReturn(timeout); if (callback.Error != null) { throw callback.Error; } return(callback.Return); }
public SendCallback(EndpointProxy endpointProxy) { this.Target = endpointProxy; this._handle = new EventWaitHandle(false, EventResetMode.AutoReset); }