public MethodCallBroker(IRequestBuilder requestBuilder, IRandomService service = null, IBeforeRequestCommandFactory beforeRequestCommandFactory = null, IResponseHandlerFactory responseHandlerFactory = null)
 {
     _requestBuilder = requestBuilder;
     _service = service ?? new RandomOrgApiService();
     _beforeRequestCommandFactory = beforeRequestCommandFactory;
     _responseHandlerFactory = responseHandlerFactory;
 }
Exemplo n.º 2
0
 public DefaultController(ILoggerFactory LoggerFactory, IRequestHandlerFactory requestHandlerFactory, IResponseHandlerFactory responseHandlerFactory)
 {
     _logger                 = LoggerFactory.CreateLogger <DefaultController>();
     _requestID              = Guid.NewGuid();
     _requestHandlerFactory  = requestHandlerFactory;
     _responseHandlerFactory = responseHandlerFactory;
 }
        public UniversalResponseThread(Address serverAddress,
                                       IResponseHandlerFactory responseHandlerFactory)
        {
            this.serverAddress          = serverAddress;
            this.responseHandlerFactory = responseHandlerFactory;

            stopRunning = false;
            IsRunning   = false;
        }
 public ServiceClient(
     HttpClient client,
     IRequestContentHandlerFactory requestContentHandlerFactory,
     IResponseHandlerFactory responseHandlerFactory)
 {
     _client = client ?? throw new ArgumentNullException(nameof(client));
     _requestContentHandlerFactory = requestContentHandlerFactory ?? throw new ArgumentNullException(nameof(requestContentHandlerFactory));
     _responseHandlerFactory       = responseHandlerFactory ?? throw new ArgumentNullException(nameof(responseHandlerFactory));
 }
        public UniversalResponseThread(NetMQContext context,
                                       Address serverAddress,
                                       IResponseHandlerFactory responseHandlerFactory)
        {
            this.context                = context;
            this.serverAddress          = serverAddress;
            this.responseHandlerFactory = responseHandlerFactory;

            stopRunning = false;
            IsRunning   = false;
        }
 public ServiceClientFactory(
     IHttpClientFactory clientFactory,
     IRequestContentHandlerFactory requestContentHandlerFactory,
     IResponseHandlerFactory responseHandlerFactory,
     IServiceRegistry serviceRegistry)
 {
     _clientFactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory));
     _requestContentHandlerFactory = requestContentHandlerFactory ?? throw new ArgumentNullException(nameof(requestContentHandlerFactory));
     _responseHandlerFactory       = responseHandlerFactory ?? throw new ArgumentNullException(nameof(responseHandlerFactory));
     _serviceRegistry = serviceRegistry ?? throw new ArgumentNullException(nameof(serviceRegistry));
 }
Exemplo n.º 7
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="randomService"><see cref="IRandomService"/> to use to get random values.  Defaults to <see cref="RandomOrgApiService"/></param>
        public UsageMethod(IRandomService randomService = null)
        {
            _randomService = randomService ?? new RandomOrgApiService();

            // We need to keep this separate so we can retrieve the list of values that are returned from to the caller
            _responseParser = new JsonResponseParserFactory(new UsageResponseParser());

            _responseHandlerFactory = new ResponseHandlerFactory(
                new ErrorHandlerThrowException(new ErrorParser()),
                _responseParser
            );
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="advisoryDelayHandler">
        /// Class which handles the apprioriate delay before the request is called.
        /// It is required that this class be passed into the method because the same instance of the <see cref="AdvisoryDelayHandler"/> must be passed in on every request.
        /// </param>
        /// <param name="randomService"><see cref="IRandomService"/> to use to get random values.  Defaults to <see cref="RandomOrgApiService"/></param>
        public UuidBasicMethod(AdvisoryDelayHandler advisoryDelayHandler, IRandomService randomService = null)
        {
            RandomService = randomService ?? new RandomOrgApiService();
            RequestBuilder = new JsonRequestBuilder(new UuidJsonRequestBuilder());

            BeforeRequestCommandFactory = new BeforeRequestCommandFactory(advisoryDelayHandler);

            // We need to keep this separate so we can retrieve the list of values that are returned from to the caller
            ResponseParser = new JsonResponseParserFactory(new UuidResponseParser());

            ResponseHandlerFactory = new ResponseHandlerFactory(
                new ErrorHandlerThrowException(new ErrorParser()),
                advisoryDelayHandler,
                new VerifyIdResponseHandler(),
                ResponseParser
            );
        }