/// <summary>
        /// Creates a communication client for the given endpoint address.
        /// </summary>
        /// <param name="endpoint">listener address where the replica is listening</param>
        /// <param name="cancellationToken">Cancellation token</param>
        /// <returns>The communication client that was created</returns>
        protected override Task <FabricTransportServiceRemotingClient> CreateClientAsync(string endpoint, CancellationToken cancellationToken)
        {
            try
            {
                var remotingHandler = new FabricTransportRemotingClientEventHandler();
                var nativeClient    = new FabricTransportClient(this.settings.GetInternalSettings(), endpoint,
                                                                remotingHandler,
                                                                this.fabricTransportRemotingCallbackMessageHandler,
                                                                this.disposer);
                FabricTransportServiceRemotingClient client = new FabricTransportServiceRemotingClient(serializersManager, nativeClient);
                remotingHandler.ClientConnected    += this.OnFabricTransportClientConnected;
                remotingHandler.ClientDisconnected += this.OnFabricTransportClientDisconnected;
                client.OpenAsync(CancellationToken.None).Wait();

                return(Task.FromResult(client));
            }
            catch (FabricInvalidAddressException)
            {
                throw new FabricInvalidAddressException(
                          string.Format(
                              CultureInfo.CurrentCulture,
                              SR.ErrorInvalidAddress,
                              endpoint
                              ));
            }
        }
Ejemplo n.º 2
0
        // we need to pass a cache of the serializers here rather than the known types,
        // the serializer cache should be maintained by the factor

        internal FabricTransportServiceRemotingClient(
            ServiceRemotingMessageSerializersManager serializersManager,
            FabricTransportClient fabricTransportClient)
        {
            this.fabricTransportClient = fabricTransportClient;
            this.serializersManager    = serializersManager;
            this.IsValid = true;
        }
 public FabricTransportServiceRemotingClient(
     FabricTransportClient nativeClient,
     FabricTransportRemotingClientConnectionHandler remotingClientConnectionHandler)
 {
     this.settings          = nativeClient.Settings;
     this.ConnectionAddress = nativeClient.ConnectionAddress;
     this.IsValid           = true;
     this.nativeClient      = nativeClient;
     this.RemotingClientConnectionHandler = remotingClientConnectionHandler;
 }
Ejemplo n.º 4
0
 public DummyFabricTransportRemotingClient(ServiceRemotingMessageSerializersManager serializersManager, FabricTransportClient fabricTransportClient) : base(serializersManager, fabricTransportClient)
 {
 }