public static void CheckWeeds(Field field, IDataProvider dataProvider, IRabbitMqBus bus) { var result = WeedCheckDataGenerator.Generate(dataProvider.GetWeedsAsync().Result); if (result != null) { var severity = DangerLevel.Low; if (result.Percentage >= 10 && result.Percentage <= 60) { severity = DangerLevel.High; } else if (result.Percentage > 60) { severity = DangerLevel.Critical; } var message = new WeedDetectedMessage() { FieldId = field.Id, OrganizationId = field.OrganizationId, WeedId = result.WeedId, Percentage = result.Percentage, Severity = severity }; bus.Publish(message); } }
public FieldController(IFieldService fieldService, IMapper mapper, IImageService imageService, IRabbitMqBus bus) { _fieldService = fieldService; _mapper = mapper; _imageService = imageService; _bus = bus; }
public static void CheckPets(Field field, IDataProvider dataProvider, IRabbitMqBus bus) { var result = PestCheckDataGenerator.Generate(dataProvider.GetPestsAsync().Result); if (result != null) { var severity = DangerLevel.Low; if (result.CountOnSquareMeter >= 50 && result.CountOnSquareMeter < 100) { severity = DangerLevel.High; } else if (result.CountOnSquareMeter > 100) { severity = DangerLevel.Critical; } var message = new PestDetectedMessage() { FieldId = field.Id, OrganizationId = field.OrganizationId, PestId = result.PestId, CountOnSquareMeter = result.CountOnSquareMeter, Severity = severity }; bus.Publish(message); } }
public UserService(IUserRepository repository, IMapper mapper, PasswordManager passwordManager, IMediator mediator, IRabbitMqBus bus, IOrganisationRepository organisationRepository) { _repository = repository; _mapper = mapper; _passwordManager = passwordManager; _bus = bus; _organisationRepository = organisationRepository; }
public static IObservable <TEvent> SubscribeToExchange <TEvent>(this IRabbitMqBus rabbitMqBus, string exchange, string queueName = "", string exchangeType = "topic", bool isExchangeDurable = true, bool isExchangeAutoDelete = true, bool isQueueDurable = false, bool isQueueAutoAck = false, bool isQueueAutoDelete = true, bool isQueueExclusive = true, Expression <Func <TEvent, bool> >?routingStrategy = null) where TEvent : class, IRabbitMqEvent { var rabbitMqQueueConfiguration = new RabbitMqQueueConfiguration <TEvent>(routingStrategy, queueName, isQueueAutoAck, isQueueDurable, isQueueAutoDelete, isQueueExclusive); var rabbitMqExchangeConfiguration = new RabbitMqExchangeConfiguration(exchange, exchangeType, true, true, isExchangeAutoDelete, isExchangeDurable); var observable = Observable.Create <TEvent>((observer) => { var rabbitMqSubscription = new RabbitMqEventSubscription <TEvent>((@event) => { observer.OnNext((TEvent)@event.Content); return(Task.CompletedTask); }, rabbitMqQueueConfiguration, rabbitMqExchangeConfiguration); rabbitMqBus.SubscribeToExchange(rabbitMqSubscription); return(Disposable.Create(() => rabbitMqBus.UnsubscribeFromExchange(rabbitMqSubscription))); }); return(observable); }
public UserController(IRabbitMqBus rabbitMqBus) { _rabbitMqBus = rabbitMqBus; }
public TicketController(IEventBus eventBus, IRabbitMqBus rabbitMqBus) { _eventBus = eventBus; _rabbitMqBus = rabbitMqBus; }
public CheckAllFieldsOnDemandHandler(IRabbitMqBus bus, IDataProvider dataProvider) { _bus = bus; _dataProvider = dataProvider; }
public BackgroundCheckWorker(IRabbitMqBus bus, IDataProvider dataProvider) { _bus = bus; _dataProvider = dataProvider; }
public CheckFieldOnDemandHandler(IRabbitMqBus bus, IFieldService fieldService, IDataProvider dataProvider) { _bus = bus; _fieldService = fieldService; _dataProvider = dataProvider; }