public override void Start() { Logger.Info("Starting dead letter consumer"); Guid consumerId = RabbitMqAdapter.StartConsumer(Globals.DeadLetterReprocessorOptions.DeadLetterConsumerOptions, _deadLetterQueueConsumer, true); do { Thread.Sleep(1000); } while (_deadLetterQueueConsumer.MessagesInQueue()); Logger.Info("DLQ empty, stopping consumer"); RabbitMqAdapter.StopConsumer(consumerId, Smi.Common.RabbitMqAdapter.DefaultOperationTimeout); if (_cliOptions.StoreOnly) { Logger.Debug("StoreOnly specified, stopping"); Stop("DLQ empty"); } else { Logger.Info("Republishing messages"); _deadLetterRepublisher.RepublishMessages(_cliOptions.ReprocessFromQueue, _cliOptions.FlushMessages); Logger.Info("Total messages republished: " + _deadLetterRepublisher.TotalRepublished); Stop("Reprocess completed"); } }
/// <summary> /// Starts up service and begins listening with the <see cref="Consumer"/> /// </summary> public override void Start() { FansiImplementations.Load(); IRDMPPlatformRepositoryServiceLocator repositoryLocator = Globals.RDMPOptions.GetRepositoryProvider(); var startup = new Startup(new EnvironmentInfo("netcoreapp2.2"), repositoryLocator); var toMemory = new ToMemoryCheckNotifier(); startup.DoStartup(toMemory); foreach (CheckEventArgs args in toMemory.Messages.Where(m => m.Result == CheckResult.Fail)) { Logger.Log(LogLevel.Warn, args.Ex, args.Message); } _fileMessageProducer = RabbitMqAdapter.SetupProducer(Globals.CohortExtractorOptions.ExtractFilesProducerOptions, isBatch: true); IProducerModel fileMessageInfoProducer = RabbitMqAdapter.SetupProducer(Globals.CohortExtractorOptions.ExtractFilesInfoProducerOptions, isBatch: false); InitializeExtractionSources(repositoryLocator); Consumer = new ExtractionRequestQueueConsumer(Globals.CohortExtractorOptions, _fulfiller, _auditor, _pathResolver, _fileMessageProducer, fileMessageInfoProducer); RabbitMqAdapter.StartConsumer(_consumerOptions, Consumer, isSolo: false); }
public void SendHeader() { var o = new GlobalOptionsFactory().Load(); var consumerOptions = new ConsumerOptions(); consumerOptions.QueueName = "TEST.HeaderPreservationTest_Read1"; consumerOptions.AutoAck = false; consumerOptions.QoSPrefetchCount = 1; TestConsumer consumer; using (var tester = new MicroserviceTester(o.RabbitOptions, consumerOptions)) { var header = new MessageHeader(); header.MessageGuid = Guid.Parse("5afce68f-c270-4bf3-b327-756f6038bb76"); header.Parents = new[] { Guid.Parse("12345678-c270-4bf3-b327-756f6038bb76"), Guid.Parse("87654321-c270-4bf3-b327-756f6038bb76") }; tester.SendMessage(consumerOptions, header, new TestMessage() { Message = "hi" }); consumer = new TestConsumer(); var a = new RabbitMqAdapter(o.RabbitOptions.CreateConnectionFactory(), "TestHost"); a.StartConsumer(consumerOptions, consumer); TestTimelineAwaiter awaiter = new TestTimelineAwaiter(); awaiter.Await(() => consumer.Failed || consumer.Passed, "timed out", 5000); a.Shutdown(RabbitMqAdapter.DefaultOperationTimeout); } Assert.IsTrue(consumer.Passed); }
public override void Start() { IRDMPPlatformRepositoryServiceLocator repositoryLocator = Globals.RDMPOptions.GetRepositoryProvider(); Consumer = new UpdateValuesQueueConsumer(Globals.UpdateValuesOptions, repositoryLocator.CatalogueRepository); RabbitMqAdapter.StartConsumer(Globals.UpdateValuesOptions, Consumer, isSolo: false); }
/// <summary> /// Start processing messages /// </summary> public override void Start() { Logger.Info("Starting consumers"); foreach (IMongoDbPopulatorMessageConsumer consumer in Consumers) { RabbitMqAdapter.StartConsumer(consumer.ConsumerOptions, consumer, isSolo: false); } Logger.Info("Consumers successfully started"); }
public override void Start() { Logger.Debug("Starting host"); _jobWatcher.Start(); // TODO(rkm 2020-03-02) Once this is transactional, we can have one "master" service which actually does the job checking RabbitMqAdapter.StartConsumer(Globals.CohortPackagerOptions.ExtractRequestInfoOptions, _requestInfoMessageConsumer, isSolo: true); RabbitMqAdapter.StartConsumer(Globals.CohortPackagerOptions.FileCollectionInfoOptions, _fileCollectionMessageConsumer, isSolo: true); RabbitMqAdapter.StartConsumer(Globals.CohortPackagerOptions.NoVerifyStatusOptions, _anonFailedMessageConsumer, isSolo: true); RabbitMqAdapter.StartConsumer(Globals.CohortPackagerOptions.VerificationStatusOptions, _anonVerificationMessageConsumer, isSolo: true); }
public void ResetSuite() { PurgeQueues(); if (_rejectorId != Guid.Empty) { _testAdapter.StopConsumer(_rejectorId, RabbitMqAdapter.DefaultOperationTimeout); } MessageRejectorConsumer = new MessageRejector { AcceptNext = false }; _rejectorId = _testAdapter.StartConsumer(_messageRejectorOptions, MessageRejectorConsumer); }
//TODO Should most of this not be in the constructor? public override void Start() { IRDMPPlatformRepositoryServiceLocator repositoryLocator = Globals.RDMPOptions.GetRepositoryProvider(); Logger.Info("About to run Startup"); var startup = new Startup(new EnvironmentInfo("netcoreapp2.2"), repositoryLocator); startup.DatabaseFound += Startup_DatabaseFound; var toMemory = new ToMemoryCheckNotifier(); startup.DoStartup(toMemory); foreach (CheckEventArgs args in toMemory.Messages) { Logger.Log(args.ToLogLevel(), args.Ex, args.Message); } Logger.Info("Startup Completed"); var lmd = repositoryLocator.CatalogueRepository.GetObjectByID <LoadMetadata>(Globals.DicomRelationalMapperOptions.LoadMetadataId); Type databaseNamerType = repositoryLocator.CatalogueRepository.MEF.GetType(Globals.DicomRelationalMapperOptions.DatabaseNamerType); string liveDatabaseName = lmd.GetDistinctLiveDatabaseServer().GetCurrentDatabase().GetRuntimeName(); var instance = ObjectFactory.CreateInstance <INameDatabasesAndTablesDuringLoads>(databaseNamerType, liveDatabaseName, Globals.DicomRelationalMapperOptions.Guid); Consumer = new DicomRelationalMapperQueueConsumer(repositoryLocator, lmd, instance, Globals.DicomRelationalMapperOptions) { RunChecks = Globals.DicomRelationalMapperOptions.RunChecks }; RabbitMqAdapter.StartConsumer(Globals.DicomRelationalMapperOptions, Consumer, isSolo: false); }
public override void Start() { _consumerId = RabbitMqAdapter.StartConsumer(_consumerOptions, Consumer, isSolo: false); }
public void TestStartConsumerThrowsOnNonExistentQueue() { _testConsumerOptions.QueueName = "TEST.WrongQueue"; Assert.Throws <ApplicationException>(() => _testAdapter.StartConsumer(_testConsumerOptions, _mockConsumer)); }
public override void Start() { RabbitMqAdapter.StartConsumer(Globals.FileCopierOptions, _consumer, isSolo: false); }
public override void Start() { // Start the consumer to await callbacks when messages arrive RabbitMqAdapter.StartConsumer(Globals.DicomTagReaderOptions, AccessionDirectoryMessageConsumer, isSolo: false); Logger.Debug("Consumer started"); }