示例#1
0
        public virtual void Error(RabbitMessage message, string errorExchange = null)
        {
            var errorMessage = new ErrorMessage
            {
                Message = MessageDetails.FromRabbitMessage(message)
            };

            _publisher.Publish(_serializer.Serialize(errorMessage), errorExchange ?? ErrorExchangeName);
        }
 private void C_AddNewCommentToQueue(object sender, CommentsUpdateEventArgs eventArgs)
 {
     foreach (var comment in eventArgs.Added)
     {
         var payload = BuildRedditQueueMessageFromRedditMessage(new CommentWrapper(comment));
         _rabbitPublisher.Publish <QueueMessage>(payload, _routingKey);
     }
     var dept = _serviceConfigurations.QueueHost;
 }
示例#3
0
        private void C_ProcessTweet(object sender, MatchedTweetReceivedEventArgs args)
        {
            var message = BuildQueueMessage(args.Tweet);

            _rabbitPublisher.Publish <QueueMessage>(message, _routingKey);
            CheckTimeToUpdateTickers();
        }
示例#4
0
 private void CheckRetryAndReque(QueueMessage message, object ch, BasicDeliverEventArgs ea)
 {
     if (message.RetryCount < 3)
     {
         message.RetryCount++;
         _rabbitConsumer.BasicAck(ea.DeliveryTag, false);
         _rabbitPublisher.Publish <QueueMessage>(message, _routingKey);
     }
     else
     {
         _rabbitConsumer.BasicReject(ea.DeliveryTag, false);
     }
 }
        public async Task Handle(
            RemoveProvinceDomainEvent notification,
            CancellationToken token)
        {
            var removeProvinceIntegrationEvent =
                new RemovedProvinceIntegrationEvent(
                    notification.CorrelationToken,
                    notification.Province.Id);

            await _rabbitPublisher
            .Publish <
                RemovedProvinceIntegrationEvent,
                RemovedProvinceExchange>(
                removeProvinceIntegrationEvent);
        }
示例#6
0
        public async Task Handle(
            AddProvinceDomainEvent notification,
            CancellationToken token)
        {
            var addProvinceIntegrationEvent =
                new AddedProvinceIntegrationEvent(
                    notification.CorrelationToken,
                    notification.Province.Id,
                    notification.Province.Title);

            await _rabbitPublisher
            .Publish <
                AddedProvinceIntegrationEvent,
                AddedProvinceExchange>(
                addProvinceIntegrationEvent);
        }
        public async Task Handle(
            UpdateTitleCountryDomainEvent notification,
            CancellationToken token)
        {
            var updateTitleCountryIntegrationEvent =
                new UpdatedTitleCountryIntegrationEvent(
                    notification.CorrelationToken,
                    notification.Country.Id,
                    notification.Country.Title);

            await _rabbitPublisher
            .Publish <
                UpdatedTitleCountryIntegrationEvent,
                UpdatedTitleCountryExchange>(
                updateTitleCountryIntegrationEvent);
        }
示例#8
0
        public IActionResult Get()
        {
            var payload = new Payload
            {
                Body = new WeatherForecast()
                {
                    Date         = DateTime.Now.AddDays(-1),
                    Summary      = Summaries[new Random().Next(0, 10)],
                    TemperatureC = new Random().Next(1, 40)
                },

                CorrelationId = Guid.NewGuid().ToString(),
            };

            publisherService.Publish(payload, new MessagingConfiguration("WeatherForecastExchange"));

            return(Ok());
        }
示例#9
0
        public async Task Handle(
            RemoveCountryDomainEvent notification,
            CancellationToken token)
        {
            var removeCountryIntegrationEvent =
                new RemovedCountryIntegrationEvent(
                    notification
                    .CorrelationToken,
                    notification
                    .Country
                    .Id,
                    notification
                    .Country
                    .Provinces
                    .Select(_ => _.Id));

            await _rabbitPublisher
            .Publish <
                RemovedCountryIntegrationEvent,
                RemovedCountryExchange>(
                removeCountryIntegrationEvent);
        }