public Task <IMessagePassingEndpoint> ConnectAsync(string endpoint, ICommunicationModuleRegistry modules)
        {
            string[] ep   = endpoint.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
            int      port = int.Parse(ep[1]);

            return(Task.FromResult(DefaultClientConnection.New(ep[0], port, modules)));
        }
        public ServiceFabricRemotingClientConnection(string serviceUrl, ICommunicationModuleRegistry mods)
        {
            this.m_modules = mods;
            var proxyFactory = new ServiceProxyFactory(c => new FabricTransportServiceRemotingClientFactory());
            var rng          = new Random();

            this.m_svcProxy = proxyFactory.CreateServiceProxy <ITrinityOverRemotingService>(
                new Uri(serviceUrl),
                new Microsoft.ServiceFabric.Services.Client.ServicePartitionKey(rng.Next()),
                listenerName: Constants.c_RemotingListenerName);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="serviceUrl"></param>
        /// <param name="mods"></param>
        public TrinityOverNativeTCPClientConnection(string serviceUrl, ICommunicationModuleRegistry mods)
        {
            this.m_modules = mods;

            //var proxyFactory = new ServiceProxyFactory(createServiceRemotingClientFactory: c => new FabricTransportServiceRemotingClientFactory());

            //var rng = new Random();

            //this.m_svcProxy = proxyFactory.CreateServiceProxy<ITrinityOverNativeTCPCommunicationService>(
            //    new Uri(serviceUrl),
            //    new ServicePartitionKey(rng.Next()),
            //    listenerName: Constants.c_trinityNativeListenerName);
        }
        // Overloaded Service Fabric RemRemoting Client Connection so that the user can
        // supply their own partition key.
        /// <summary>
        ///
        /// </summary>
        /// <param name="serviceUrl"></param>
        /// <param name="mods"></param>
        /// <param name="userPartitionKey"></param>
        public TrinityOverNativeTCPClientConnection(string serviceUrl,
                                                    ICommunicationModuleRegistry mods,
                                                    ServicePartitionKey userPartitionKey = null)
        {
            m_userSuppliedPartitionKey = userPartitionKey ?? new ServicePartitionKey(new Random().Next());

            this.m_modules = mods;

            //ServiceProxyFactory proxyFactory = new ServiceProxyFactory(serviceRemotingFactory => new FabricTransportServiceRemotingClientFactory());

            //this.m_svcProxy = proxyFactory.CreateServiceProxy<ITrinityOverNativeTCPCommunicationService>(new Uri(serviceUrl),
            //                                                                               m_userSuppliedPartitionKey,
            //                                                                               listenerName: Constants.c_trinityNativeListenerName);
        }
Esempio n. 5
0
 /// <summary>
 /// ConnectAsync into Service Fabric Cluster and return an Trinity Messaging endpoint. This call makes it
 /// possible to connect from a remote client outside of the service fabric cluster
 /// </summary>
 /// <param name="connectionString"></param>
 /// <param name="modules"></param>
 /// <param name="userServicePartitionKey"></param>
 /// <returns></returns>
 public Task <IMessagePassingEndpoint> ConnectAsync(string connectionString, ICommunicationModuleRegistry modules, ServicePartitionKey userServicePartitionKey)
 {
     // this is a down-level call from the TrinityClient object making a call into the service fabric runtime to connect to a remote service cluster
     return(Task.FromResult <IMessagePassingEndpoint>(new TrinityOverNativeTCPClientConnection <TrinityOverNativeTCPClientProxy>(connectionString, modules, userServicePartitionKey)));
 }
Esempio n. 6
0
 /// <summary>
 /// ConnectAsync into Service Fabric Cluster and return an Trinity Messaging endpoint. This call makes it
 /// possible to connect from within the service fabric cluster
 /// </summary>
 /// <param name="connectionString"></param>
 /// <param name="modules"></param>
 /// <returns></returns>
 public Task <IMessagePassingEndpoint> ConnectAsync(string connectionString, ICommunicationModuleRegistry modules)
 {
     // Make a service-to-server in a node-to-node cluster environment
     return(Task.FromResult <IMessagePassingEndpoint>(new TrinityOverNativeTCPClientConnection <TrinityOverNativeTCPClientProxy>(connectionString, modules)));
 }
 internal static IMessagePassingEndpoint New(string host, int port, ICommunicationModuleRegistry modules)
 {
     return(new DefaultClientConnection(new ServerInfo(host, port, null, LogLevel.Info), modules));
 }
 protected internal DefaultClientConnection(ServerInfo server, ICommunicationModuleRegistry modules)
     : base(new[] { server }, NetworkConfig.Instance.ClientMaxConn, null, -1, nonblocking: true)
 {
     m_modules = modules;
 }
Esempio n. 9
0
 /// <summary>
 /// ConnectAsync into Service Fabric Cluster and return an Trinity Messaging endpoint. This call makes it
 /// possible to connect from within the service fabric cluster
 /// </summary>
 /// <param name="connectionString"></param>
 /// <param name="modules"></param>
 /// <returns></returns>
 public Task <IMessagePassingEndpoint> ConnectAsync(string connectionString, ICommunicationModuleRegistry modules)
 {
     // Make a service-to-server in a node-to-node cluster environment
     return(Task.FromResult <IMessagePassingEndpoint>(new ServiceFabricRemotingClientConnection(connectionString, modules)));
 }
Esempio n. 10
0
 public Task <IMessagePassingEndpoint> ConnectAsync(string connectionString, ICommunicationModuleRegistry modules)
 {
     return(Task.FromResult <IMessagePassingEndpoint>(new ServiceFabricRemotingClientConnection(connectionString, modules)));
 }