예제 #1
0
 virtual protected IEventSource CreateEventSource(Uri streamUri, Dictionary <string, string> headers)
 {
     EventSource.Configuration config = new EventSource.Configuration(
         uri: streamUri,
         messageHandler: _config.HttpClientHandler,
         connectionTimeOut: _config.HttpClientTimeout,
         delayRetryDuration: _config.ReconnectTime,
         readTimeout: _config.ReadTimeout,
         requestHeaders: headers,
         logger: LogManager.GetLogger(typeof(EventSource.EventSource))
         );
     return(new EventSource.EventSource(config));
 }
예제 #2
0
 private IEventSource DefaultEventSourceCreator(StreamProperties streamProperties, IDictionary <string, string> headers)
 {
     EventSource.Configuration config = EventSource.Configuration.Builder(streamProperties.StreamUri)
                                        .Method(streamProperties.Method)
                                        .RequestBodyFactory(() => streamProperties.RequestBody)
                                        .MessageHandler(_config.HttpClientHandler)
                                        .ConnectionTimeout(_config.HttpClientTimeout)
                                        .DelayRetryDuration(_config.ReconnectTime)
                                        .ReadTimeout(_config.ReadTimeout)
                                        .RequestHeaders(headers)
                                        .Logger(LogManager.GetLogger(typeof(EventSource.EventSource)))
                                        .Build();
     return(new EventSource.EventSource(config));
 }