Exemplo n.º 1
0
        /// <summary>
        /// Instantiates the <see cref="CorrelatingServiceProxyFactory"/> with the specified remoting factory and retrysettings.
        /// </summary>
        /// <param name="serviceContext">The service context for the calling service</param>
        /// <param name="createServiceRemotingClientFactory">
        /// Specifies the factory method that creates the remoting client factory. The remoting client factory got from this method
        /// is cached in the ServiceProxyFactory.
        /// </param>
        /// <param name="retrySettings">Specifies the retry policy to use on exceptions seen when using the proxies created by this factory</param>
        public CorrelatingServiceProxyFactory(ServiceContext serviceContext, Func <Microsoft.ServiceFabric.Services.Remoting.V1.IServiceRemotingCallbackClient, Microsoft.ServiceFabric.Services.Remoting.V1.Client.IServiceRemotingClientFactory> createServiceRemotingClientFactory = null, OperationRetrySettings retrySettings = null)
        {
            this.methodNameProvider = new MethodNameProvider(true /* threadSafe */);

            // Layer the factory structure so the hierarchy will look like this:
            // CorrelatingServiceProxyFactory
            //  --> ServiceProxyFactory
            //      --> CorrelatingServiceRemotingFactory
            //          --> <Factory created by createServcieRemotingClientFactory>
            this.serviceProxyFactory = new ServiceProxyFactory(
                callbackClient => {
                Microsoft.ServiceFabric.Services.Remoting.V1.Client.IServiceRemotingClientFactory innerClientFactory = createServiceRemotingClientFactory(callbackClient);
                return(new CorrelatingServiceRemotingClientFactory(innerClientFactory, this.methodNameProvider));
            },
                retrySettings);
        }
 private void InitializeCommonFields()
 {
     this.telemetryClient    = new TelemetryClient();
     this.methodNameProvider = new MethodNameProvider(false /* threadSafe */);
 }
 private void InitializeCommonFields()
 {
     this.telemetryClient    = new TelemetryClient();
     this.baggageSerializer  = new Lazy <DataContractSerializer>(() => new DataContractSerializer(typeof(IEnumerable <KeyValuePair <string, string> >)));
     this.methodNameProvider = new MethodNameProvider(false /* threadSafe */);
 }