Exemplo n.º 1
0
 public LocalWebHookProcessor(IWebHookSubscriptionStore subscriptionStore, IWebHookClient webHookClient,
                              IOptions <ClientStoreOptions> clientStoreOptions, ILogger <LocalWebHookProcessor> logger)
 {
     _subscriptionStore  = subscriptionStore;
     _webHookClient      = webHookClient;
     _logger             = logger;
     _clientStoreOptions = clientStoreOptions?.Value ?? new ClientStoreOptions();
 }
Exemplo n.º 2
0
        public override void ActivateOptions()
        {
            base.ActivateOptions();

            if (string.IsNullOrEmpty(WebHookUrl))
            {
                throw new LogException($"{nameof(WebHookUrl)} must not be empty or null.");
            }
            if (SerializerType == null)
            {
                throw new LogException($"{nameof(SerializerType)} must not be empty or null.");
            }

            var serializer = Activator.CreateInstance(SerializerType) as IJsonHttpContentConverter;

            if (serializer == null)
            {
                throw new LogException($"{nameof(SerializerType)} must implements {typeof(IJsonHttpContentConverter).FullName}.");
            }

            _client = new WebHookClient(serializer);
        }