示例#1
0
        private static async Task StartJob(
            IJobManager jobManager,
            TwitterCredentialsOptions twitterCredentialsOptions,
            TwitterMetadata metadata
            )
        {
            // var query = "snakebite;snakebites;\"morsure de serpent\";\"morsures de serpents\";\"لدغات الأفاعي\";\"لدغة الأفعى\";\"لدغات أفاعي\";\"لدغة أفعى\"";
            // TODO add NOT cocktail NOT music
            // var query = "snake bite NOT cocktail NOT darts NOT piercing";

            var jobId     = Guid.Parse("a43e8bb4-9c15-48a8-a0a3-7479b75eb6d0");
            var jobConfig = new DataAcquirerJobConfig()
            {
                Attributes = new Dictionary <string, string>
                {
                    { "TopicQuery", metadata.Query },
                    { "AccessToken", twitterCredentialsOptions.AccessToken },
                    { "AccessTokenSecret", twitterCredentialsOptions.AccessTokenSecret },
                    { "ApiKey", twitterCredentialsOptions.ApiKey },
                    { "ApiSecretKey", twitterCredentialsOptions.ApiSecretKey },
                },
                JobId = jobId,
                OutputMessageBrokerChannels = new string[] { "job_management.component_data_input.DataAnalyser_sentiment" }
            };

            try
            {
                await jobManager.StartNewJobAsync(jobConfig);
            }
            catch
            {
            }
        }
示例#2
0
 public JobManipulationUseCase(
     IRegistrationService registrationService,
     IMessageBrokerConsumer interactiveConsumer,
     IOptions <TwitterCredentialsOptions> twitterCredentialsOptionsAccessor,
     JobConfigurationUpdateListenerHostedService jobConfigurationUpdateListenerHostedService,
     IOptions <ComponentOptions> componentOptionsAccessor,
     ILogger <JobManipulationUseCase> logger)
 {
     _twitterCredentials  = twitterCredentialsOptionsAccessor.Value;
     _registrationService = registrationService;
     _jobConfigurationUpdateListenerHostedService = jobConfigurationUpdateListenerHostedService;
     _interactiveConsumer = interactiveConsumer as InteractiveConsumer;
     _logger           = logger;
     _componentOptions = componentOptionsAccessor.Value;
 }