public void ShouldDisposeEndpointClientIfWrappedInLoggingProxy() { IServiceEndpointClient endpointClient = A.Fake <IServiceEndpointClient>(); IServiceEndpointClient loggingProxy = new ServiceEndpointClientLoggingProxy(A.Fake <ILoggerFactory>(), endpointClient, message => LogLevel.Info, message => LogLevel.Info); loggingProxy.Dispose(); A.CallTo(() => endpointClient.Dispose()).MustHaveHappened(1, Times.Exactly); }
public async Task Given_NoEndpointsForCommand_When_SendAsyncMultiple_SingleCommand_Assert_ThrowsNoEndpointsConfigured() { var serviceEndpointClients = new IServiceEndpointClient <IMessage, ICommand, IEvent, IRequest, IResponse>[] { new FakeServiceEndpoint(typeof(TestServiceCommand2)) }; var serviceEndpoints = Enumerable.Empty <IServiceEndpoint <IMessage, ICommand, IEvent, IRequest, IResponse> >(); var sut = new ServiceBusClient <IMessage, ICommand, IEvent, IRequest, IResponse>(serviceEndpointClients, serviceEndpoints, new DefaultRequestCorrelationProvider()); var commands = new[] { new TestServiceCommand1() }; await Assert.ThrowsAsync <AggregateException>(() => sut.SendAsync(commands)); }
public ServiceEndpointClientMonitoringProxy(IServiceEndpointClient <TMessage, TCommand, TEvent, TRequest, TResponse> endpointClient, IMonitorFactory <TMessage> monitorFactory) { if (endpointClient == null) { throw new NullReferenceException("endpointClient cannot be null"); } if (monitorFactory == null) { throw new NullReferenceException("monitorFactory cannot be null"); } _endpointClient = endpointClient; _monitor = monitorFactory.Create(endpointClient.Name); }
public DisposingServiceEndpointClient(IServiceEndpointClient <TMessage, TCommand, TEvent, TRequest, TResponse> endpointClient, IDisposable disposable) { _endpointClient = endpointClient; _disposable = disposable; }
public ICanAddEndpointOrLoggingOrCorrelationOrCreate <TMessage, TCommand, TEvent, TRequest, TResponse> WithEndpoint(IServiceEndpointClient <TMessage, TCommand, TEvent, TRequest, TResponse> endpointClient) { _endpointClients.Add(endpointClient); return(this); }
public static IObservable <TEvent> EventsWithErrorHandling <TMessage, TCommand, TEvent, TRequest, TResponse>(this IServiceEndpointClient <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.Events.CatchAndHandle(exceptions, () => endpoint.Events, string.Format("Error receiving {0} from endpoint {1}", typeof(TEvent), endpoint.Name))); }
protected IObservable <TEvent> EventsWithErroHandling(IServiceEndpointClient <TMessage, TCommand, TEvent, TRequest, TResponse> endpoint) { return(endpoint.Events.CatchAndHandle(_exceptions, () => endpoint.Events, string.Format("Error receiving {0} from endpoint {1}", typeof(TEvent), endpoint.GetType().FullName))); }
public static IServiceEndpointClient <TMessage, TCommand, TEvent, TRequest, TResponse> CreateMonitoringProxy <TMessage, TCommand, TEvent, TRequest, TResponse>(this IServiceEndpointClient <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 ServiceEndpointClientMonitoringProxy <TMessage, TCommand, TEvent, TRequest, TResponse>(endpoint, monitorFactory)); }
public static IServiceEndpointClient <TMessage, TCommand, TEvent, TRequest, TResponse> CreateLoggingProxy <TMessage, TCommand, TEvent, TRequest, TResponse>(this IServiceEndpointClient <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 ServiceEndpointClientLoggingProxy <TMessage, TCommand, TEvent, TRequest, TResponse>(loggerFactory, endpoint, logLevelSend, logLevelReceive)); }
protected IObservable <IEvent> EventsWithErroHandling(IServiceEndpointClient endpoint) { return(endpoint.Events.CatchAndHandle(_exceptions, () => endpoint.Events, string.Format("Error receiving {0} from endpoint {1}", typeof(IEvent), endpoint.GetType().FullName))); }
public ServiceEndpointClientLoggingProxy(ILoggerFactory loggerFactory, IServiceEndpointClient <IMessage, ICommand, IEvent, IRequest, IResponse> endpoint, Func <Type, LogLevel> logLevelSend, Func <Type, LogLevel> logLevelReceive) : base(loggerFactory, endpoint, logLevelSend, logLevelReceive) { }
public ICanAddEndpointOrCreate WithEndpoint(IServiceEndpointClient endpointClient) { _endpointClients.Add(endpointClient); return(this); }