Пример #1
0
        public LinkConsumerFactory(IServiceEndpoint serviceEndpoint, IServiceEndpointMessageClientCache clientCache)
        {
            _clientCache = clientCache;

            _instanceInfo = serviceEndpoint.InstanceInfo;
            _serviceInfo  = serviceEndpoint.ServiceInfo;
        }
        public ServiceEndpointConfigurationObserver(IConsumePipeConfigurator configurator, IServiceEndpoint endpoint)
            : base(configurator)
        {
            _endpoint = endpoint;

            Connect(this);
        }
        void ConfigureServiceEndpoint(IServiceEndpoint serviceEndpoint, TEndpointConfigurator endpointConfigurator,
                                      Action <TEndpointConfigurator> configureEndpoint)
        {
            ConfigureServiceEndpoint(endpointConfigurator);

            serviceEndpoint.ConnectConfigurationObserver(endpointConfigurator);
            configureEndpoint(endpointConfigurator);
        }
Пример #4
0
        public void ShouldDisposeEndpointIfWrappedInLoggingProxy()
        {
            IServiceEndpoint endpoint     = A.Fake <IServiceEndpoint>();
            IServiceEndpoint loggingProxy = new ServiceEndpointLoggingProxy(A.Fake <ILoggerFactory>(), endpoint, message => LogLevel.Info, message => LogLevel.Info);

            loggingProxy.Dispose();

            A.CallTo(() => endpoint.Dispose()).MustHaveHappened(1, Times.Exactly);
        }
Пример #5
0
        public MessageEndpoint(IServiceEndpoint endpoint)
        {
            _endpoint = endpoint;

            var cacheSettings = new CacheSettings(10000, TimeSpan.FromSeconds(1), TimeSpan.FromMinutes(30));

            _cache = new GreenCache <ClientInfo>(cacheSettings);
            _index = _cache.AddIndex("clientId", x => x.ClientId);
        }
Пример #6
0
 public static IServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse> CreateMonitoringProxy <TMessage, TCommand, TEvent, TRequest, TResponse>(
     this IServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse> endpoint,
     IMonitorFactory <TMessage> monitorFactory)
     where TMessage : class
     where TCommand : TMessage
     where TEvent : TMessage
     where TRequest : TMessage
     where TResponse : TMessage
 {
     return(new ServiceEndpointMonitoringProxy <TMessage, TCommand, TEvent, TRequest, TResponse>(endpoint, monitorFactory));
 }
        public ServiceEndpointConfigurator(IServiceInstance instance, IEndpointConfigurationObserverConnector connector,
                                           IReceiveEndpointConfigurator serviceEndpointConfigurator, IReceiveEndpointConfigurator controlEndpointConfigurator = null)
        {
            _serviceEndpointConfigurator = serviceEndpointConfigurator;
            _controlEndpointConfigurator = controlEndpointConfigurator;

            _configurationHandles = new List <ConnectHandle>();

            _endpoint = instance.CreateServiceEndpoint(serviceEndpointConfigurator);

            ConnectConfigurationObserver(serviceEndpointConfigurator);

            _configurationHandles.Add(connector.ConnectEndpointConfigurationObserver(this));
        }
Пример #8
0
        public ServiceEndpointMonitoringProxy(IServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse> endpoint, IMonitorFactory <TMessage> monitorFactory)
        {
            if (endpoint == null)
            {
                throw new NullReferenceException("endpoint cannot be null");
            }
            if (monitorFactory == null)
            {
                throw new NullReferenceException("monitorFactory cannot be null");
            }

            _endpoint = endpoint;
            _monitor  = monitorFactory.Create(endpoint.Name);
        }
Пример #9
0
 private bool TryServiceStart(IServiceEndpoint c)
 {
     _logger.Information("Starting service endpoint {endPointName}", c.EndpointDescription);
     try
     {
         c.StartServer();
         return(true); // we assume synchronous starting, but maybe future readiness checks shouldn't
     }
     catch (Exception ex)
     {
         _logger.Fatal(ex, "Unable to start service {endPointName}", c.EndpointDescription);
         throw ex;
     }
 }
Пример #10
0
        public SpanTracer(ZipkinConfig zipkinConfig, ISpanCollector spanCollector, IServiceEndpoint zipkinEndpoint)
        {
            if (zipkinConfig == null)
            {
                throw new ArgumentNullException(nameof(zipkinConfig));
            }
            if (spanCollector == null)
            {
                throw new ArgumentNullException(nameof(spanCollector));
            }
            if (zipkinEndpoint == null)
            {
                throw new ArgumentNullException(nameof(zipkinEndpoint));
            }

            _spanCollector  = spanCollector;
            _zipkinEndpoint = zipkinEndpoint;
            _zipkinConfig   = zipkinConfig;
        }
Пример #11
0
 public MessageEndpoint(IServiceEndpoint endpoint)
 {
     _endpoint = endpoint;
 }
Пример #12
0
 public DisposingServiceEndpoint(IServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse> endpoint, IDisposable disposable)
 {
     _endpoint   = endpoint;
     _disposable = disposable;
 }
Пример #13
0
 protected IObservable <IRequest> RequestsWithErrorHandling(IServiceEndpoint endpoint)
 {
     return(endpoint.Requests.CatchAndHandle(_exceptions, () => endpoint.Requests, string.Format("Error receiving {0} from endpoint {1}", typeof(IRequest), endpoint.GetType().FullName)));
 }
 public TFLRoadFeatures()
 {
     _program = new TflClient();
     _program.Setup();
     _roadService = _program.ServiceProvider.GetService(typeof(IServiceEndpoint <RoadCorridor>)) as IServiceEndpoint <RoadCorridor>;
 }
Пример #15
0
        public ICanAddEndpointOrCreate WithEndpoint(IServiceEndpoint endpoint)
        {
            _endpoints.Add(endpoint);

            return(this);
        }
 public ServiceEndpointLoggingProxy(ILoggerFactory loggerFactory, IServiceEndpoint <IMessage, ICommand, IEvent, IRequest, IResponse> endpoint, Func <Type, LogLevel> logLevelSend, Func <Type, LogLevel> logLevelReceive)
     : base(loggerFactory, endpoint, logLevelSend, logLevelReceive)
 {
 }
 protected IObservable <TRequest> RequestsWithErrorHandling(IServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse> endpoint)
 {
     return(endpoint.Requests.CatchAndHandle(_exceptions, () => endpoint.Requests, string.Format("Error receiving {0} from endpoint {1}", typeof(TRequest), endpoint.GetType().FullName)));
 }
Пример #18
0
 public static IServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse> CreateLoggingProxy <TMessage, TCommand, TEvent, TRequest, TResponse>(this IServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse> endpoint,
                                                                                                                                                       ILoggerFactory loggerFactory,
                                                                                                                                                       Func <Type, LogLevel> logLevelSend,
                                                                                                                                                       Func <Type, LogLevel> logLevelReceive)
     where TMessage : class
     where TCommand : TMessage
     where TEvent : TMessage
     where TRequest : TMessage
     where TResponse : TMessage
 {
     return(new ServiceEndpointLoggingProxy <TMessage, TCommand, TEvent, TRequest, TResponse>(loggerFactory, endpoint, logLevelSend, logLevelReceive));
 }
Пример #19
0
 public ICanAddEndpointOrLoggingOrCorrelationOrCreate <TMessage, TCommand, TEvent, TRequest, TResponse> WithEndpoint(IServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse> endpoint)
 {
     _endpoints.Add(endpoint);
     return(this);
 }
Пример #20
0
 public static IObservable <TRequest> RequestsWithErrorHandling <TMessage, TCommand, TEvent, TRequest, TResponse>(this IServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse> endpoint, IObserver <Exception> exceptions)
     where TMessage : class
     where TCommand : TMessage
     where TEvent : TMessage
     where TRequest : TMessage
     where TResponse : TMessage
 {
     return(endpoint.Requests.CatchAndHandle(exceptions, () => endpoint.Requests, string.Format("Error receiving {0} from endpoint {1}", typeof(TRequest), endpoint.Name)));
 }
Пример #21
0
 public void LoadEndpoint(IServiceEndpoint serviceEndpoint)
 {
     _ServiceEndpoint = serviceEndpoint;
     _ServiceEndpoint.Start();
 }