Exemple #1
0
        /// <summary>
        /// This is the main entry point for your service replica.
        /// This method executes when this replica of your service becomes primary and has write status.
        /// </summary>
        /// <param name="cancellationToken">Canceled when Service Fabric needs to shut down this service replica.</param>
        protected override async Task RunAsync(CancellationToken cancellationToken)
        {
            return;

            var proxyFactory  = new ServiceProxyFactory(c => new FabricTransportServiceRemotingClientFactory());
            var proxyFactory2 = new ServiceProxyFactory(c => new CorrelatingFabricTransportServiceRemotingClientFactory <ISampleService>());

            //ISampleService service = proxyFactory2.CreateServiceProxy<ISampleService>(
            //   new Uri("fabric:/LogMagic.FabricTestApp2/LogMagic.FabricTestApp.StatelessSimulator"));

            ISampleService service = CorrelatingProxyFactory.CreateServiceProxy <ISampleService>(
                new Uri("fabric:/LogMagic.FabricTestApp2/LogMagic.FabricTestApp.StatelessSimulator"),
                raiseSummary: RaiseSummary,
                remoteServiceName: "StatelessSimulator");

            using (L.Context("param1", "value1"))
            {
                try
                {
                    string hey = await service.PingSuccessAsync("hey");

                    hey = await service.PingFailureAsync("fail");
                }
                catch (Exception ex)
                {
                    ex = null;
                }
            }
        }
        private ISampleService CreateSampleService()
        {
            ISampleService service = CorrelatingProxyFactory.CreateServiceProxy <ISampleService>(
                new Uri("fabric:/LogMagic.FabricTestApp2/LogMagic.FabricTestApp.StatelessSimulator"),
                raiseSummary: RaiseSummary,
                remoteServiceName: "StatelessSimulator");

            return(service);
        }
Exemple #3
0
        /// <summary>
        /// This is the main entry point for your service replica.
        /// This method executes when this replica of your service becomes primary and has write status.
        /// </summary>
        /// <param name="cancellationToken">Canceled when Service Fabric needs to shut down this service replica.</param>
        protected override async Task RunAsync(CancellationToken cancellationToken)
        {
            var proxyFactory  = new ServiceProxyFactory(c => new FabricTransportServiceRemotingClientFactory());
            var proxyFactory2 = new ServiceProxyFactory(c => new CorrelatingFabricTransportServiceRemotingClientFactory());

            //ISampleService service = proxyFactory2.CreateServiceProxy<ISampleService>(
            //   new Uri("fabric:/LogMagic.FabricTestApp2/LogMagic.FabricTestApp.StatelessSimulator"));

            ISampleService service = CorrelatingProxyFactory.CreateServiceProxy <ISampleService>(
                new Uri("fabric:/LogMagic.FabricTestApp2/LogMagic.FabricTestApp.StatelessSimulator"));

            using (L.Context(new KeyValuePair <string, string>("param1", "value1")))
            {
                string hey = await service.GetHelloAsync("hey");
            }
        }
        public async Task <IEnumerable <string> > Get()
        {
            IRootService rootService = CorrelatingProxyFactory.CreateServiceProxy <IRootService>(
                new Uri("fabric:/LogMagic.FabricTestApp2/StatefulSimulator"),
                new ServicePartitionKey(0),
                remoteServiceName: "root");

            try
            {
                await rootService.TestCall();
            }
            catch (Exception ex)
            {
                ex = null;
            }

            return(new string[] { "value1", "value2" });
        }