예제 #1
0
 public EventSubscribtionHostedService(IOptions <KafkaConfig> options, ILoggerFactory loggerFactory,
                                       NebulaService nebulaService)
 {
     _options       = options;
     _loggerFactory = loggerFactory;
     _nebulaService = nebulaService;
 }
예제 #2
0
 public EventConsumer(IOptions <KafkaConfig> options,
                      ILoggerFactory logger, string topicName, NebulaService nebulaService) : base(options, logger,
                                                                                                   ConsumerDiagnosticProvider.GetStat(typeof(EventConsumer).FullName, topicName), topicName)
 {
     _nebulaService = nebulaService;
     _logger        = logger.CreateLogger(nameof(EventConsumer));
     Initialize(new List <KeyValuePair <string, object> >(), MessageReceived);
 }
        public async Task Subscribe(OutputChannelModificationInfo modificationInfo, NebulaService nebulaService)
        {
            var outputChannelSpecification = modificationInfo.OutputChannel.TypeSpecification;

            if (outputChannelSpecification == null)
            {
                return;
            }

            nebulaService.ModifyInMemoryOutputChannels(modificationInfo.OutputChannel);

            if (outputChannelSpecification is HttpPushOutputChannelSpecification channelSpecification)
            {
                await nebulaService.CreateOrUpdateJobAsync(channelSpecification.TargetUrl, modificationInfo.OutputChannel.ExternalKey)
                .ContinueWith(res => nebulaService.StartJobIfNotStarted(res.Result));
            }
            else
            {
                throw new ArgumentNullException($"OutputChannel Type is not supported");
            }
        }
 public async Task Subscribe(OutputChannelModificationInfo modificationInfo, NebulaService nebulaService)
 {
     nebulaService.RemoveInMemoryOutputChannels(modificationInfo.OutputChannel);
     await nebulaService.StopJob(modificationInfo.OutputChannel.JobId);
 }