internal CorrelatingFabricTransportServiceRemotingClientFactory(
            FabricTransportRemotingSettings remotingSettings = null,
            IServiceRemotingCallbackMessageHandler remotingCallbackMessageHandler = null,
            IServicePartitionResolver servicePartitionResolver = null,
            IEnumerable <IExceptionHandler> exceptionHandlers  = null,
            string traceId = null,
            IServiceRemotingMessageSerializationProvider serializationProvider = null,
            IServiceRemotingClientFactory inner = null,
            Action <CallSummary> raiseSummary   = null,
            string remoteServiceName            = null)
        {
            if (inner == null)
            {
                inner = new FabricTransportServiceRemotingClientFactory(
                    remotingSettings,
                    remotingCallbackMessageHandler,
                    servicePartitionResolver,
                    exceptionHandlers,
                    traceId,
                    serializationProvider);
            }

            _inner             = inner;
            _raiseSummary      = raiseSummary;
            _remoteServiceName = remoteServiceName ?? "unknown";
        }
コード例 #2
0
        /// <summary>
        ///     Constructs a WCF based service remoting client factory.
        /// </summary>
        /// <param name="clientBinding">
        ///     WCF binding to use for the client. If the client binding is not specified or null,
        ///     a default client binding is created using
        ///     <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.WcfUtility.CreateTcpClientBinding"/> method
        ///     which creates a <see cref="System.ServiceModel.NetTcpBinding"/> with no security.
        /// </param>
        /// <param name="callbackClient">
        ///     The callback client that receives the callbacks from the service.
        /// </param>
        /// <param name="exceptionHandlers">
        ///     Exception handlers to handle the exceptions encountered in communicating with the service.
        /// </param>
        /// <param name="servicePartitionResolver">
        ///     Service partition resolver to resolve the service endpoints. If not specified, a default
        ///     service partition resolver returned by <see cref="ServicePartitionResolver.GetDefault"/> is used.
        /// </param>
        /// <param name="traceId">
        ///     Id to use in diagnostics traces from this component.
        /// </param>
        /// <param name="createWcfClientFactory">
        ///     Delegate function that creates <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.Client.WcfCommunicationClientFactory{TServiceContract}"/> using the
        ///     <see cref="Microsoft.ServiceFabric.Services.Remoting.V2.Wcf.IServiceRemotingContract"/>.
        /// </param>
        /// <param name="serializationProvider"></param>
        /// <remarks>
        ///     This factory uses <see cref="WcfExceptionHandler"/> and <see cref="ServiceRemotingExceptionHandler"/> in addition to the
        ///     exception handlers supplied to the constructor.
        /// </remarks>
        public WcfServiceRemotingClientFactory(
            Binding clientBinding = null,
            IServiceRemotingCallbackMessageHandler callbackClient = null,
            IEnumerable <IExceptionHandler> exceptionHandlers     = null,
            IServicePartitionResolver servicePartitionResolver    = null,
            string traceId = null,
            Func <
                Binding,
                IEnumerable <IExceptionHandler>,
                IServicePartitionResolver,
                string,
                IServiceRemotingCallbackContract,
                WcfCommunicationClientFactory <IServiceRemotingContract> > createWcfClientFactory = null,
            IServiceRemotingMessageSerializationProvider serializationProvider = null)

        {
            if (serializationProvider == null)
            {
                serializationProvider = new BasicDataContractSerializationProvider();
            }

            var serializersManager = new ServiceRemotingMessageSerializersManager(serializationProvider,
                                                                                  new BasicDataContractHeaderSerializer());

            this.Initialize(serializersManager,
                            clientBinding,
                            callbackClient,
                            exceptionHandlers,
                            servicePartitionResolver,
                            traceId,
                            createWcfClientFactory);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Uri serviceUri = new Uri("fabric:/SimpleStoreApplication/ShoppingCartService");
            IServicePartitionResolver serviceResolver = ServicePartitionResolver.GetDefault();
            Binding binding          = WcfUtility.CreateTcpClientBinding();
            var     wcfClientFactory =
                new WcfCommunicationClientFactory <IShoppingCartService>(
                    clientBinding: binding, servicePartitionResolver: serviceResolver);

            for (int i = 1; i <= 3; i++)
            {
                // var shoppingClient = new Client(wcfClientFactory, serviceUri, i);
                var shoppingClient = new Client(wcfClientFactory, serviceUri, "Customer " + i);

                shoppingClient.AddItem(new ShoppingCartItem
                {
                    ProductName = "XBOX ONE",
                    UnitPrice   = 329.0,
                    Amount      = 2
                }).Wait();

                PrintPartition(shoppingClient);

                var list = shoppingClient.GetItems().Result;
                foreach (var item in list)
                {
                    Console.WriteLine(string.Format("{0}: {1:C2} X {2} = {3:C2}",
                                                    item.ProductName,
                                                    item.UnitPrice,
                                                    item.Amount,
                                                    item.LineTotal));
                }
            }
            Console.ReadKey();
        }
        internal CommunicationClientFactoryBase(
            bool fireConnectEvents,
            IServicePartitionResolver servicePartitionResolver = null,
            IEnumerable <IExceptionHandler> exceptionHandlers  = null,
            string traceId = null
            )
        {
            this.fireConnectEvents = fireConnectEvents;
            this.random            = new Random();
            this.randomLock        = new object();
            this.traceId           = traceId ?? Guid.NewGuid().ToString();

            this.servicePartitionResolver = servicePartitionResolver ?? ServicePartitionResolver.GetDefault();

            this.exceptionHandlers = new List <IExceptionHandler>();
            if (exceptionHandlers != null)
            {
                this.exceptionHandlers.AddRange(exceptionHandlers);
            }

            this.cache = new CommunicationClientCache <TCommunicationClient>(this.traceId);

            ServiceTrace.Source.WriteInfo(
                TraceType,
                "{0} constructor",
                this.traceId);
        }
        private void Initialize(FabricTransportRemotingSettings remotingSettings,
                                IServiceRemotingCallbackMessageHandler remotingCallbackMessageHandler,
                                IServicePartitionResolver servicePartitionResolver,
                                IEnumerable <IExceptionHandler> exceptionHandlers,
                                string traceId,
                                IServiceRemotingMessageSerializationProvider serializationProvider,
                                IServiceRemotingMessageHeaderSerializer headerSerializer = null)
        {
            remotingSettings = remotingSettings ?? FabricTransportRemotingSettings.GetDefault();

            if (headerSerializer == null)
            {
                headerSerializer = new ServiceRemotingMessageHeaderSerializer(new BufferPoolManager(remotingSettings.HeaderBufferSize, remotingSettings.HeaderMaxBufferCount));
            }

            var serializersManager = new ServiceRemotingMessageSerializersManager(serializationProvider,
                                                                                  headerSerializer);


            this.Initialize(remotingSettings,
                            remotingCallbackMessageHandler,
                            servicePartitionResolver,
                            exceptionHandlers,
                            traceId,
                            serializersManager.GetSerializationProvider().CreateMessageBodyFactory(),
                            serializersManager);
        }
 public GrpcCommunicationClientFactory(
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     IServicePartitionResolver servicePartitionResolver = null,
     string traceId = null)
     : base(servicePartitionResolver, GetExceptionHandlers(exceptionHandlers), traceId)
 {
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpRequestDispatcherProvider"/> class.
 /// </summary>
 /// <param name="servicePartitionResolver">
 /// The service partition resolver.
 /// </param>
 /// <param name="exceptionHandlers">
 /// The exception handlers.
 /// </param>
 /// <param name="traceId">
 /// The trace id.
 /// </param>
 public HttpRequestDispatcherProvider(
     IServicePartitionResolver servicePartitionResolver = null,
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     string traceId = null)
     : this(() => new HttpRequestDispatcher(), servicePartitionResolver, exceptionHandlers, traceId)
 {
 }
コード例 #8
0
        private void Initialize(ServiceRemotingMessageSerializersManager serializersManager, Binding clientBinding,
                                IServiceRemotingCallbackMessageHandler callbackClient, IEnumerable <IExceptionHandler> exceptionHandlers,
                                IServicePartitionResolver servicePartitionResolver, string traceId, Func <Binding, IEnumerable <IExceptionHandler>, IServicePartitionResolver, string, IServiceRemotingCallbackContract, WcfCommunicationClientFactory <IServiceRemotingContract> > createWcfClientFactory)
        {
            this.serializersManager = serializersManager;
            if (traceId == null)
            {
                traceId = Guid.NewGuid().ToString();
            }

            if (createWcfClientFactory == null)
            {
                this.wcfFactory = new WcfCommunicationClientFactory <IServiceRemotingContract>(
                    clientBinding,
                    GetExceptionHandlers(exceptionHandlers, traceId),
                    servicePartitionResolver,
                    traceId,
                    this.GetCallbackImplementation(callbackClient));
            }
            else
            {
                this.wcfFactory = createWcfClientFactory(
                    clientBinding,
                    GetExceptionHandlers(exceptionHandlers, traceId),
                    servicePartitionResolver,
                    traceId,
                    this.GetCallbackImplementation(callbackClient));
            }


            this.wcfFactory.ClientConnected    += this.OnClientConnected;
            this.wcfFactory.ClientDisconnected += this.OnClientDisconnected;

            this.remotingMessageBodyFactory = this.serializersManager.GetSerializationProvider().CreateMessageBodyFactory();
        }
 public ServiceFabricEndpointDiscovery(FabricClient fabricClient, IServicePartitionResolver servicePartitionResolver, IOptions <ServiceFabricProviderOptions> options, IOcelotLoggerFactory factory)
 {
     _fabricClient             = fabricClient;
     _servicePartitionResolver = servicePartitionResolver;
     _options = options.Value;
     _logger  = factory.CreateLogger <ServiceFabricEndpointDiscovery>();
 }
コード例 #10
0
 public FabricQueryManager(
     FabricClient fabricClient,
     IServicePartitionResolver resolver)
 {
     this.fabricClient       = fabricClient;
     this.resolver           = resolver;
     this.timeoutPerAttempt  = TimeSpan.FromSeconds(30);
     this.maxBackoffInterval = TimeSpan.FromSeconds(90);
 }
 public CacheCommunicationClientFactory(
     IRequestContext context,
     ILocalCache localCache,
     IServicePartitionResolver resolver = null,
     IEnumerable <IExceptionHandler> exceptionHandlers = null)
     : base(resolver, CreateExceptionHandlers(context, exceptionHandlers))
 {
     _localCache = localCache;
     _context    = context;
 }
コード例 #12
0
        private WcfClient <IFEPServiceAsync> BuildClient()
        {
            Binding binding = WcfUtility.CreateTcpClientBinding();
            IServicePartitionResolver partitionResolver = ServicePartitionResolver.GetDefault();
            var wcfClientFactory = new WcfCommunicationClientFactory <IFEPServiceAsync>(clientBinding: binding, servicePartitionResolver: partitionResolver);
            var ServiceUri       = new Uri(_uri);
            var client           = new WcfClient <IFEPServiceAsync>(wcfClientFactory, ServiceUri);

            return(client);
        }
        public static WcfServiceFabricCommunicationClient <T> GetClient(Uri uri, Binding binding)
        {
            IServicePartitionResolver partitionResolver = ServicePartitionResolver.GetDefault();
            var wcfClientFactory = new WcfCommunicationClientFactory <T>
                                       (clientBinding: binding, servicePartitionResolver: partitionResolver);

            var client = new WcfServiceFabricCommunicationClient <T>(wcfClientFactory, uri, ServicePartitionKey.Singleton);

            return(client);
        }
コード例 #14
0
        public BookingCommunicationClientFactory(IServicePartitionResolver resolver, ICustomerAccessTokenProvider accessTokenProvider)
            : base(resolver, new[] { new HttpExceptionHandler() })
        {
            if (accessTokenProvider == null)
            {
                throw new ArgumentNullException(nameof(accessTokenProvider));
            }

            this.accessTokenProvider = accessTokenProvider;
        }
 /// <summary>
 /// Initializes a new instance of the communication client factory.
 /// </summary>
 /// <param name="servicePartitionResolver">Optional ServicePartitionResolver</param>
 /// <param name="exceptionHandlers">Optional Custom exception handlers for the exceptions on the Client to Service communication channel</param>
 /// <param name="traceId">Identifier to use in diagnostics traces from this component </param>
 protected CommunicationClientFactoryBase(
     IServicePartitionResolver servicePartitionResolver = null,
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     string traceId = null)
     : this(false,
            servicePartitionResolver,
            exceptionHandlers,
            traceId)
 {
 }
コード例 #16
0
        private WcfClient <IScadaStorageService> BuildClient()
        {
            Binding binding = WcfUtility.CreateTcpClientBinding();
            IServicePartitionResolver partitionResolver = ServicePartitionResolver.GetDefault();
            var wcfClientFactory = new WcfCommunicationClientFactory <IScadaStorageService>(clientBinding: binding, servicePartitionResolver: partitionResolver);
            var ServiceUri       = new Uri(_uri);
            var client           = new WcfClient <IScadaStorageService>(wcfClientFactory, ServiceUri, new Microsoft.ServiceFabric.Services.Client.ServicePartitionKey(1));

            return(client);
        }
コード例 #17
0
 public CorrelatingFabricTransportServiceRemotingClientFactory(
     FabricTransportRemotingSettings remotingSettings = null,
     IServiceRemotingCallbackMessageHandler remotingCallbackMessageHandler = null,
     IServicePartitionResolver servicePartitionResolver = null,
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     string traceId = null,
     IServiceRemotingMessageSerializationProvider serializationProvider = null) :
     this(remotingSettings, remotingCallbackMessageHandler, servicePartitionResolver, exceptionHandlers, traceId, serializationProvider, null)
 {
 }
コード例 #18
0
        // GET api/values/5
        public CustomerProfile GetById(string id)
        {
            CustomerProfile _profile = null;

            Binding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);

            // Create a partition resolver
            IServicePartitionResolver partitionResolver = ServicePartitionResolver.GetDefault();
            // create a  WcfCommunicationClientFactory object.
            var wcfClientFactory = new WcfCommunicationClientFactory <INBKCentral>
                                       (clientBinding: binding, servicePartitionResolver: partitionResolver);


            //
            // Create a client for communicating with the ICalculator service that has been created with the
            // Singleton partition scheme.
            //
            var nbkcentralServiceCommunicationClient = new EAIP1CommunicationClient(
                wcfClientFactory,
                eaip1ServiceUri,
                ServicePartitionKey.Singleton);

            int _total = 0;
            //
            // Call the service to perform the operation.
            //
            DataSet _result = nbkcentralServiceCommunicationClient.InvokeWithRetry(
                client => client.Channel.Read("Customer_Process_Portfolio",
                                              "GetCustomerProfile",
                                              new NBK.Common.Foundations.Utilities.FilterCriteria[] { new NBK.Common.Foundations.Utilities.FilterCriteria {
                                                                                                          CompOp = NBK.Common.Foundations.Utilities.ComparisonOperator.Equal, CondOp = NBK.Common.Foundations.Utilities.ConditionalOperator.And, FieldName = "CustomerNo", FieldValue = new string[] { id }, SubExpr = NBK.Common.Foundations.Utilities.SubExpression.None
                                                                                                      } }, null, -1, -1, ref _total));

            if (_result != null && _result.Tables.Count > 0 && _result.Tables[0].Rows.Count > 0)
            {
                DataRow _row = _result.Tables[0].Rows[0];

                _profile = new CustomerProfile
                {
                    CustomerNumber         = _row["CustomerNumber"].ToString(),
                    TotalCashLiability     = _row["TotalCashLiability"].ToString(),
                    TotalCashLimit         = _row["TotalCashLimit"].ToString(),
                    TotalCollateral        = _row["TotalCollateral"].ToString(),
                    TotalEarnedAssets      = _row["TotalEarnedAssets"].ToString(),
                    TotalFreeFunds         = _row["TotalFreeFunds"].ToString(),
                    TotalIndirectLiability = _row["TotalIndirectLiability"].ToString(),
                    TotalNBKFunds          = _row["TotalNBKFundValue"].ToString(),
                    TotalNonCashLiability  = _row["TotalNonCashLiability"].ToString(),
                    TotalNonCashLimit      = _row["TotalNonCashLimit"].ToString()
                };
            }

            return(_profile);
        }
コード例 #19
0
        public FilesCommunicationClientFactory(IServicePartitionResolver resolver, IAccessTokenProvider accessTokenProvider, IOptions <ApiOptions> apiOptions)
            : base(resolver, new[] { new HttpExceptionHandler() })
        {
            if (accessTokenProvider == null)
            {
                throw new ArgumentNullException(nameof(accessTokenProvider));
            }

            this.accessTokenProvider = accessTokenProvider;
            this.apiOptions          = apiOptions.Value;
        }
コード例 #20
0
        static void Main(string[] args)
        {
            Uri serviceUri = new Uri("fabric:/CalculatorApplication3/CalculatorService");
            IServicePartitionResolver serviceResolver = ServicePartitionResolver.GetDefault();
            Binding binding          = WcfUtility.CreateTcpClientBinding();
            var     wcfClientFactory = new WcfCommunicationClientFactory <ICalculatorService>(
                clientBinding: binding, servicePartitionResolver: serviceResolver);
            var calcClient = new Client(wcfClientFactory, serviceUri);

            Console.WriteLine(calcClient.Add(3, 5).Result);
            Console.ReadKey();
        }
コード例 #21
0
        public static void Execute()
        {
            var services = new ServiceCollection();
            IServicePartitionResolver partitionResolver = ServicePartitionResolver.GetDefault();

            services.AddSingleton <IKvpConfigService>(
                ServiceProxy.Create <IKvpConfigService>(new Uri("fabric:/ConfigService/CoreService"), new ServicePartitionKey(0))
                );
            services.AddSingleton <ILogger>(new DebugLogger());
            var provider = services.BuildServiceProvider();

            ConfigServiceClientFactory._serviceProvider = provider;
        }
コード例 #22
0
 private static async Task reportCancellation(string url)
 {
     Binding binding = WcfUtility.CreateTcpClientBinding();
     IServicePartitionResolver partitionResolver = ServicePartitionResolver.GetDefault();
     var wcfClientFactory = new WcfCommunicationClientFactory <IStateAggregator>(
         clientBinding: binding,
         servicePartitionResolver: partitionResolver
         );
     var jobClient = new ServicePartitionClient <WcfCommunicationClient <IStateAggregator> >(
         wcfClientFactory,
         new Uri("fabric:/AudioTranscriptionApp/StateAggregator"));
     await jobClient.InvokeWithRetryAsync(client => client.Channel.ReportCancellation(url));
 }
 /// <summary>
 ///     Constructs a WCF based actor remoting factory.
 /// </summary>
 /// <param name="clientBinding">
 ///     WCF binding to use for the client. If the client binding is null,
 ///     a default client binding is created using
 ///     <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.WcfUtility.CreateTcpClientBinding"/> method
 ///     which creates a <see cref="System.ServiceModel.NetTcpBinding"/> with no security.
 /// </param>
 /// <param name="callbackClient">
 ///     The callback client that receives the callbacks from the service.
 /// </param>
 /// <param name="exceptionHandlers">
 ///     Exception handlers to handle the exceptions encountered in communicating with the service.
 /// </param>
 /// <param name="servicePartitionResolver">
 ///     Service partition resolver to resolve the service endpoints. If not specified, a default
 ///     service partition resolver returned by <see cref="ServicePartitionResolver.GetDefault"/> is used.
 /// </param>
 /// <param name="traceId">
 ///     Id to use in diagnostics traces from this component.
 /// </param>
 /// <remarks>
 ///     This factory uses <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.Client.WcfExceptionHandler"/>,
 ///     <see cref="Microsoft.ServiceFabric.Services.Remoting.Client.ServiceRemotingExceptionHandler"/> and
 ///     <see cref="Microsoft.ServiceFabric.Actors.Remoting.Client.ActorRemotingExceptionHandler"/>, in addition to the
 ///     exception handlers supplied to the constructor.
 /// </remarks>
 public WcfActorRemotingClientFactory(
     Binding clientBinding,
     IServiceRemotingCallbackClient callbackClient,
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     IServicePartitionResolver servicePartitionResolver = null,
     string traceId = null) :
     base(
         clientBinding,
         callbackClient,
         GetExceptionHandlers(exceptionHandlers),
         servicePartitionResolver,
         traceId)
 {
 }
コード例 #24
0
 /// <summary>
 /// Constructs a fabric transport based actor remoting client factory.
 /// </summary>
 /// <param name="fabricTransportRemotingSettings">
 ///     The settings for the fabric transport. If the settings are not provided or null, default settings
 ///     with no security.
 /// </param>
 /// <param name="callbackClient">
 ///     The callback client that receives the callbacks from the service.
 /// </param>
 /// <param name="servicePartitionResolver">
 ///     Service partition resolver to resolve the service endpoints. If not specified, a default
 ///     service partition resolver returned by <see cref="ServicePartitionResolver.GetDefault"/> is used.
 /// </param>
 /// <param name="exceptionHandlers">
 ///     Exception handlers to handle the exceptions encountered in communicating with the actor.
 /// </param>
 /// <param name="traceId">
 ///     Id to use in diagnostics traces from this component.
 /// </param>
 public FabricTransportActorRemotingClientFactory(
     FabricTransportRemotingSettings fabricTransportRemotingSettings,
     IServiceRemotingCallbackClient callbackClient,
     IServicePartitionResolver servicePartitionResolver = null,
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     string traceId = null) :
     base(
         fabricTransportRemotingSettings,
         callbackClient,
         servicePartitionResolver,
         GetExceptionHandlers(exceptionHandlers),
         traceId)
 {
 }
        public GrpcCommunicationClientFactory(
            ILogger logger, ChannelCache channelCache,
            Func <Channel, TClient> creator,
            IServicePartitionResolver servicePartitionResolver = null,
            IEnumerable <IExceptionHandler> exceptionHandlers  = null,
            string traceId = null) : base(servicePartitionResolver, GetExceptionHandlers(logger, exceptionHandlers), traceId)
        {
            Log           = logger;
            _channelCache = channelCache;
            _creator      = creator;

            ClientConnected    += GrpcCommunicationClientFactory_ClientConnected;
            ClientDisconnected += GrpcCommunicationClientFactory_ClientDisconnected;
        }
コード例 #26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpRequestDispatcherProvider"/> class.
        /// </summary>
        /// <param name="innerDispatcherProvider">
        /// The inner dispatcher provider.
        /// </param>
        /// <param name="servicePartitionResolver">
        /// The service partition resolver.
        /// </param>
        /// <param name="exceptionHandlers">
        /// The exception handlers.
        /// </param>
        /// <param name="traceId">
        /// The trace id.
        /// </param>
        /// <exception cref="ArgumentNullException">The inner dispatcher provider is null.</exception>
        public HttpRequestDispatcherProvider(
            Func <HttpRequestDispatcher> innerDispatcherProvider,
            IServicePartitionResolver servicePartitionResolver = null,
            IEnumerable <IExceptionHandler> exceptionHandlers  = null,
            string traceId = null)
            : base(servicePartitionResolver, exceptionHandlers, traceId)
        {
            if (innerDispatcherProvider == null)
            {
                throw new ArgumentNullException(nameof(innerDispatcherProvider));
            }

            this.innerDispatcherProvider = innerDispatcherProvider;
        }
コード例 #27
0
        public MyServiceRemotingClientFactory(
            IServiceRemotingCallbackClient callbackClient,
            IServicePartitionResolver resolver = null,
            IEnumerable <IExceptionHandler> exceptionHandlers = null)
        {
            this.innerRemotingClientFactory = new FabricTransportServiceRemotingClientFactory(
                new FabricTransportSettings(),
                callbackClient,
                resolver,
                exceptionHandlers);

            this.innerRemotingClientFactory.ClientConnected    += this.ClientConnected;
            this.innerRemotingClientFactory.ClientDisconnected += this.ClientDisconnected;
        }
コード例 #28
0
        public async Task <IEnumerable <JobStatus> > Jobs()
        {
            Binding binding = WcfUtility.CreateTcpClientBinding();
            IServicePartitionResolver partitionResolver = ServicePartitionResolver.GetDefault();
            var wcfClientFactory = new WcfCommunicationClientFactory <IStateAggregator>(
                clientBinding: binding,
                servicePartitionResolver: partitionResolver
                );
            var jobClient = new ServicePartitionClient <WcfCommunicationClient <IStateAggregator> >(
                wcfClientFactory,
                new Uri("fabric:/AudioTranscriptionApp/StateAggregator"));
            var result = await jobClient.InvokeWithRetryAsync(client => client.Channel.ListJobs());

            return(result);
        }
 public FabricTransportServiceRemotingClientFactoryImpl(
     Remoting.FabricTransport.FabricTransportRemotingSettings fabricTransportRemotingSettings = null,
     IServiceRemotingCallbackClient callbackHandler     = null,
     IServicePartitionResolver servicePartitionResolver = null,
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     string traceId = null)
     : base(
         servicePartitionResolver,
         GetExceptionHandlers(exceptionHandlers),
         traceId)
 {
     this.settings = fabricTransportRemotingSettings ?? FabricTransportRemotingSettings.GetDefault();
     this.fabricTransportRemotingCallbackMessageHandler =
         new FabricTransportRemotingCallbackMessageHandler(callbackHandler);
 }
        protected string GetTenantDBConnection(string tenant)
        {
            Binding binding = WcfUtility.CreateTcpClientBinding();
            IServicePartitionResolver partitionResolver = ServicePartitionResolver.GetDefault();

            var wcfClientFactory = new WcfCommunicationClientFactory <IDbConnectionService>(clientBinding: binding, servicePartitionResolver: partitionResolver);

            var client = new ServicePartitionClient <WcfCommunicationClient <IDbConnectionService> >(wcfClientFactory, new Uri(SF_CONFIG_DBCONNECTION_SERVICE));

            var results = client.InvokeWithRetry(
                c => c.Channel.IdentifyTenantDatabase(tenant)
                );

            return(results);
        }