public void AddResponder(IResponseProcessor responder) { if (!responders.ContainsKey(responder.TypeName)) { responders.Add(responder.TypeName, responder); } }
public RabbitMqClient(IResponseProcessor responseProcessor, IQueueConfiguration queueConfiguration, ILogger <RabbitMqClient <TResponseProcessor> > logger, IRabbitMqConnectionFactory rabbitMqConnectionFactory) { _responseProcessor = responseProcessor ?? throw new ArgumentNullException(nameof(responseProcessor)); _queueConfiguration = queueConfiguration ?? throw new ArgumentNullException(nameof(queueConfiguration)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _rabbitMqConnectionFactory = rabbitMqConnectionFactory ?? throw new ArgumentNullException(nameof(rabbitMqConnectionFactory)); }
public ServiceProvider(ICommunicator <string, ServiceResponse> communicator, IResponseProcessor <ServiceResponse, BusinessResponse> responseProcessor, ILogger logger) { this.communicator = communicator; this.responseProcessor = responseProcessor; this.logger = logger; }
public GitHubOAuthAuthorizer(IRestClientFactory factory, IResponseProcessor processor) { Requires.ArgumentNotNull(factory, "factory"); Requires.ArgumentNotNull(processor, "processor"); _factory = factory; _processor = processor; }
private static Response SafeInvokeResponseProcessor(IResponseProcessor responseProcessor, MediaRange mediaRange, object model, NancyContext context) { try { return(responseProcessor.Process(mediaRange, model, context)); } catch (Exception e) { context.WriteTraceLog(sb => sb.AppendFormat("[DefaultRouteInvoker] Processor threw {0} exception: {1}", e.GetType(), e.Message)); } return(null); }
internal RippleApiLight(string rippleSocketUri, IResponseProcessor responseProcessor) { _rippleSocketUri = rippleSocketUri; _responseProcessor = responseProcessor; _webSocket = new WebSocket(_rippleSocketUri); _webSocket.Opened += websocket_Opened; _webSocket.Error += websocket_Error; _webSocket.Closed += websocket_Closed; _webSocket.MessageReceived += websocket_MessageReceived; _webSocket.Open(); Thread.Sleep(1000); //Give it some time to establish the connection }
public RabbitMqClient(IResponseProcessor responseProcessor, IQueueConfiguration queueConfiguration, ILogger <RabbitMqClient <TResponseProcessor> > logger) { _responseProcessor = responseProcessor ?? throw new ArgumentNullException(nameof(responseProcessor)); _queueConfiguration = queueConfiguration ?? throw new ArgumentNullException(nameof(queueConfiguration)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _logger.LogInformation($"Setting up queue connection '{queueConfiguration.MBHostName}:{queueConfiguration.MBPort}'"); connectionFactory = new ConnectionFactory() { HostName = queueConfiguration.MBHostName, Port = queueConfiguration.MBPort, UserName = ConnectionFactory.DefaultUser, Password = ConnectionFactory.DefaultPass }; }
private GitHubClient CreateClient(IRestClientFactory factory = null, IResponseProcessor processor = null) { if (processor == null) { GitHubException ex = null; var mockProcessor = new Mock <IResponseProcessor>(MockBehavior.Strict); mockProcessor.Setup(p => p.TryProcessResponseErrors(It.IsAny <IGitHubResponse>(), out ex)) .Returns(false); processor = mockProcessor.Object; } return(new GitHubClient(factory ?? new Mock <IRestClientFactory>(MockBehavior.Strict).Object, processor)); }
public GitHubClient(IRestClientFactory factory, IResponseProcessor processor) { Requires.ArgumentNotNull(factory, "factory"); Requires.ArgumentNotNull(processor, "processor"); _factory = factory; _processor = processor; Authenticator = new NullAuthenticator(); _users = new UserService(this); _issues = new IssueService(this); _repositories = new RepositoryService(this); _pullRequests = new PullRequestService(this); _organizations = new OrganizationService(this); }
public AdaptationRequestSender(IResponseProcessor responseProcessor, IAdaptationResponseCollection collection, ILogger <AdaptationRequestSender> logger, IArchiveProcessorConfig config) { _responseProcessor = responseProcessor ?? throw new ArgumentNullException(nameof(responseProcessor)); _collection = collection ?? throw new ArgumentNullException(nameof(collection)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); if (config == null) { throw new ArgumentNullException(nameof(config)); } var connectionFactory = new ConnectionFactory() { HostName = config.AdaptationRequestQueueHostname, Port = config.AdaptationRequestQueuePort, UserName = config.MessageBrokerUser, Password = config.MessageBrokerPassword }; _connection = connectionFactory.CreateConnection(); _channel = _connection.CreateModel(); _consumer = new EventingBasicConsumer(_channel); _channel.BasicConsume(_consumer, "amq.rabbitmq.reply-to", autoAck: true); _consumer.Received += (model, ea) => { try { _receivedMessageCount++; _logger.LogInformation($"Received message: Exchange Name: '{ea.Exchange}', Routing Key: '{ea.RoutingKey}'"); var headers = ea.BasicProperties.Headers; var body = ea.Body.ToArray(); var response = _responseProcessor.Process(headers); _collection.Add(response); } catch (Exception ex) { _logger.LogError(ex, $"Error Processing 'input'"); _collection.Add(new KeyValuePair <Guid, AdaptationOutcome>(Guid.Empty, AdaptationOutcome.Error)); } }; _logger.LogInformation($"AdaptationRequestSender Connection established to {config.AdaptationRequestQueueHostname}"); }
internal static IResponseProcessor GetResponseProcessor(IOwinContext context) { IResponseProcessor responseProcessor = null; //get formater var createProcessors = CreateProcessorsFunc(); var processorList = createProcessors(context); foreach (var processor in processorList) { if (processor.CanProcess()) { responseProcessor = processor; break; } } return(responseProcessor); }
private static Response SafeInvokeResponseProcessor(IResponseProcessor responseProcessor, MediaRange mediaRange, object model, NancyContext context) { try { return responseProcessor.Process(mediaRange, model, context); } catch (Exception e) { context.WriteTraceLog(sb => sb.AppendFormat("[DefaultRouteInvoker] Processor threw {0} exception: {1}", e.GetType(), e.Message)); } return null; }
private GitHubClient CreateClient(IRestClientFactory factory = null, IResponseProcessor processor = null) { if (processor == null) { GitHubException ex = null; var mockProcessor = new Mock<IResponseProcessor>(MockBehavior.Strict); mockProcessor.Setup(p => p.TryProcessResponseErrors(It.IsAny<IGitHubResponse>(), out ex)) .Returns(false); processor = mockProcessor.Object; } return new GitHubClient(factory ?? new Mock<IRestClientFactory>(MockBehavior.Strict).Object, processor); }
private GitHubOAuthAuthorizer CreateAuthorizer(IRestClientFactory factory = null, IResponseProcessor processor = null) { return(new GitHubOAuthAuthorizer(factory ?? new Mock <IRestClientFactory>(MockBehavior.Strict).Object, processor ?? new Mock <IResponseProcessor>(MockBehavior.Strict).Object)); }
public Process(IResponseProcessor processor) { Processor = processor; }
/// <summary> /// Registers a response processor that waits for messages containing a response to the /// message with the specified identifier. /// </summary> /// <param name="replyId">ID of the source message.</param> /// <param name="iResponseProcessor">A response processor instance.</param> public void RegisterResponseProcessor(int replyId, IResponseProcessor iResponseProcessor) { GenuineReceivingHandler._responseHandlers[replyId] = iResponseProcessor; }
internal ResponseFilterLogic(IResponseProcessor processor, int totalBytes) { this.processor = processor; this.responseData = new byte[totalBytes]; this.state = State.Reading; }
private GitHubOAuthAuthorizer CreateAuthorizer(IRestClientFactory factory = null, IResponseProcessor processor = null) { return new GitHubOAuthAuthorizer(factory ?? new Mock<IRestClientFactory>(MockBehavior.Strict).Object, processor ?? new Mock<IResponseProcessor>(MockBehavior.Strict).Object); }
public KonicaGameBehavior() { responseProcessor = GameSocketServer.Container.Resolve <IResponseProcessor>(); responseProcessor.GameEngine = GameSocketServer.Container.Resolve <IGameEngine>(); responseProcessor.GameEngine.Board = GameSocketServer.Container.Resolve <IBoard>(); }
public ContentDeserializationProcessor() { innerProcessor = new TryContentDeserializationProcessor <TResult, TSerializer>(); }
public void RemoveReponder(IResponseProcessor responder) { responders.Remove(responder.TypeName); }