Esempio n. 1
0
        private static void Main()
        {
            // Nebula.RegisterJobQueue(typeof(SampleJobQueue), nameof(SampleJobQueue));
            Nebula.RegisterJobQueue(typeof(RedisJobQueue <>), QueueType.Redis);
            Nebula.RegisterJobProcessor(typeof(SampleJobProcessor), typeof(SampleJobStep));
            Nebula.ConnectionConfig("Connections.config");

            var jobManager = Nebula.GetJobManager();

            CreateJob(jobManager).Wait();
        }
Esempio n. 2
0
 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"
     };
 }
Esempio n. 3
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.");
        }
Esempio n. 4
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.");
        }
Esempio n. 5
0
        public ProcessorGeneralTests()
        {
            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
            };
            Options = Microsoft.Extensions.Options.Options.Create(
                new RetryConfiguration {
                Count = 0, Interval = 0
            });
            Processor = new HttpPushOutgoingQueueProcessor(MockLogger.Object, MockMessageDa.Object, Options);
            NebulaContext.RegisterJobProcessor(Processor, typeof(HttpPushOutgoingQueueStep));
        }