Beispiel #1
0
        public HttpOutgoingQueueProcessorTests()
        {
            MockLogger    = new Mock <ILogger <HttpPushOutgoingQueueProcessor> >();
            MockMessageDa = new Mock <IMessageLogDa>();
            NebulaContext = new NebulaContext();
            NebulaContext.RegisterJobQueue(typeof(MockDelayedQueue), QueueType.Delayed);
            Interlocked.Increment(ref _portNumber);
            var baseAddress = $"http://localhost:{_portNumber}";

            Parameters = new HttpPushOutgoingQueueParameters
            {
                TargetUrl = $"{baseAddress}/endpoint"
            };
            StubHttp         = HttpMockRepository.At(baseAddress);
            JobConfiguration = new JobConfigurationData
            {
                MaxBatchSize = 1,
                MaxConcurrentBatchesPerWorker = 5,
                IdleSecondsToCompletion       = 30,
                MaxBlockedSecondsPerCycle     = 60,
                MaxTargetQueueLength          = 100000,
                QueueTypeName = QueueType.Redis,
                Parameters    = JsonConvert.SerializeObject(Parameters)
            };

            JobData = new JobData
            {
                JobId         = "test_job_id",
                Configuration = JobConfiguration,
                TenantId      = TenantId
            };
        }
Beispiel #2
0
 public void Initialize(JobData jobData, NebulaContext nebulaContext)
 {
     JobData = jobData;
     Trace.WriteLine($@"
                     Initialization:
                         guid: {Guid}
                         jobId: {JobData.JobId}
                         _transientService1: {_transientService1.Guid}");
 }
Beispiel #3
0
        public NebulaService(IOptions <NebulaConfig> options, IServiceProvider serviceProvider,
                             IOutputChannelDa outputChannelDa)
        {
            var nebulaConfig = options?.Value ?? throw new ArgumentNullException(nameof(options));

            _serviceProvider = serviceProvider;
            _outputChannelDa = outputChannelDa;
            NebulaContext    = new NebulaContext();
            ConfigureNebulaContext(nebulaConfig);
        }
 public ProcessorRetryTests()
 {
     Options   = Microsoft.Extensions.Options.Options.Create(retryConfiguration);
     Processor = new HttpPushOutgoingQueueProcessor(MockLogger.Object, MockMessageDa.Object, Options);
     NebulaContext.RegisterJobProcessor(Processor, typeof(HttpPushOutgoingQueueStep));
     _step = new HttpPushOutgoingQueueStep
     {
         Category  = "test_category",
         FailCount = 0,
         Payload   = "test_message"
     };
 }
Beispiel #5
0
        private static void Main()
        {
            Console.WriteLine("Abaci.JobQueue.Worker worker service...");

            var nebulaContext = new NebulaContext();

            nebulaContext.RegisterJobQueue(typeof(RedisJobQueue <>), QueueType.Redis);
            nebulaContext.RegisterJobProcessor(typeof(SampleJobProcessor), typeof(SampleJobStep));
            nebulaContext.ConnectionConfig("Connections.config");

            nebulaContext.StartWorkerService();

            Console.WriteLine("Service started. Press ENTER to stop.");
            Console.ReadLine();

            Console.WriteLine("Stopping the serivce...");
            nebulaContext.StopWorkerService();
            Console.WriteLine("Service stopped, everything looks clean.");
        }
Beispiel #6
0
        private static void Main()
        {
            Console.WriteLine("Abaci.JobQueue.Worker worker service...");

            var nebulaContext = new NebulaContext();

            nebulaContext.RegisterJobQueue(typeof(DelayedJobQueue <>), QueueType.Delayed);
            nebulaContext.RegisterJobQueue(typeof(KafkaJobQueue <>), QueueType.Kafka);


            // register processor by type
            // nebulaContext.RegisterJobProcessor(typeof(SampleJobProcessor),typeof(SampleJobStep));

            //register processor object
            nebulaContext.RegisterJobProcessor(new SampleJobProcessor(), typeof(SampleJobStep));

            nebulaContext.MongoConnectionString = "mongodb://localhost:27017/SampleJob";
            nebulaContext.RedisConnectionString = "localhost:6379";
            nebulaContext.KafkaConfig           = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>("bootstrap.servers", "172.30.3.59:9101"),
                new KeyValuePair <string, object>("group.id", "testGroup"),
                new KeyValuePair <string, object>("auto.commit.interval.ms", 5000),
                new KeyValuePair <string, object>("enable.auto.commit", true),
                new KeyValuePair <string, object>("statistics.interval.ms", 60000),
                new KeyValuePair <string, object>("auto.offset.reset", "earliest"),
                new KeyValuePair <string, object>("queue.buffering.max.ms", 1),
                new KeyValuePair <string, object>("batch.num.messages", 1),
                new KeyValuePair <string, object>("fetch.wait.max.ms", 5000),
                new KeyValuePair <string, object>("fetch.min.bytes", 1),
            };


            nebulaContext.StartWorkerService();

            Console.WriteLine("Service started. Press ENTER to stop.");
            Console.ReadLine();

            Console.WriteLine("Stopping the serivce...");
            nebulaContext.StopWorkerService();
            Console.WriteLine("Service stopped, everything looks clean.");
        }
Beispiel #7
0
        public void Initialize(JobData jobData, NebulaContext nebulaContext)
        {
            if (jobData == null)
            {
                throw new ArgumentNullException(nameof(jobData), ErrorKeys.ParameterNull);
            }

            if (nebulaContext == null)
            {
                throw new ArgumentNullException(nameof(nebulaContext), ErrorKeys.ParameterNull);
            }

            _jobId    = jobData.JobId;
            _jobQueue = nebulaContext.JobStepSourceBuilder.BuildDelayedJobQueue <HttpPushOutgoingQueueStep>(_jobId);
            var parametersString = jobData.Configuration?.Parameters;

            if (string.IsNullOrWhiteSpace(parametersString))
            {
                throw new ArgumentNullException(nameof(jobData.Configuration.Parameters), ErrorKeys.ParameterNull);
            }

            _parameters = JsonConvert.DeserializeObject <HttpPushOutgoingQueueParameters>(parametersString);
        }
Beispiel #8
0
 public void Initialize(JobData jobData, NebulaContext nebulaContext)
 {
     _nebulaContext = nebulaContext;
 }
Beispiel #9
0
 public PluginController(RegistryService registryService, NebulaContext context)
 {
     _registryService = registryService;
     _nebulaContext   = context;
 }
Beispiel #10
0
 public void ClassInit()
 {
     Tenant.GetCurrentTenant();
     Nebula = new NebulaContext();
     ConfigureNebula();
 }
Beispiel #11
0
 public void ClassInit()
 {
     Nebula = new NebulaContext();
     ConfigureNebula();
 }
Beispiel #12
0
 public UserService(NebulaContext context)
 {
     _context = context;
 }
Beispiel #13
0
 public TemplateController(RegistryService registryService, NebulaContext context)
 {
     _registryService    = registryService;
     _nebulaContext      = context;
     _registryService.Db = _nebulaContext;
 }