Exemple #1
0
        public bool Subscribe(IAmazonSQS amazonSQSClient, SqsQueueBase queue)
        {
            var subscriptionArn = Client.SubscribeQueue(Arn, amazonSQSClient, queue.Url);
            if (!string.IsNullOrEmpty(subscriptionArn))
            {
                return true;
            }

            Log.Info(string.Format("Failed to subscribe Queue to Topic: {0}, Topic: {1}", queue.Arn, Arn));
            return false;
        }
Exemple #2
0
 public MessageDispatcher(
     SqsQueueBase queue,
     IMessageSerialisationRegister serialisationRegister,
     IMessageMonitor messagingMonitor,
     Action <Exception, SQSMessage> onError,
     HandlerMap handlerMap)
 {
     _queue = queue;
     _serialisationRegister = serialisationRegister;
     _messagingMonitor      = messagingMonitor;
     _onError    = onError;
     _handlerMap = handlerMap;
 }
 public MessageDispatcher(
     SqsQueueBase queue, 
     IMessageSerialisationRegister serialisationRegister,
     IMessageMonitor messagingMonitor,
     Action<Exception, SQSMessage> onError,
     HandlerMap handlerMap)
 {
     _queue = queue;
     _serialisationRegister = serialisationRegister;
     _messagingMonitor = messagingMonitor;
     _onError = onError;
     _handlerMap = handlerMap;
 }
Exemple #4
0
 public MessageDispatcher(
     SqsQueueBase queue,
     IMessageSerialisationRegister serialisationRegister,
     IMessageMonitor messagingMonitor,
     Action <Exception, SQSMessage> onError,
     HandlerMap handlerMap,
     ILoggerFactory loggerFactory)
 {
     _queue = queue;
     _serialisationRegister = serialisationRegister;
     _messagingMonitor      = messagingMonitor;
     _onError    = onError;
     _handlerMap = handlerMap;
     _log        = loggerFactory.CreateLogger("JustSaying");
 }
Exemple #5
0
        public SqsNotificationListener(
            SqsQueueBase queue,
            IMessageSerialisationRegister serialisationRegister,
            IMessageMonitor messagingMonitor,
            Action <Exception, Amazon.SQS.Model.Message> onError = null,
            IMessageLock messageLock = null)
        {
            _queue            = queue;
            _messagingMonitor = messagingMonitor;
            onError           = onError ?? ((ex, message) => { });

            _messageProcessingStrategy = new DefaultThrottledThroughput(_messagingMonitor);
            _messageHandlerWrapper     = new MessageHandlerWrapper(messageLock, _messagingMonitor);
            _messageDispatcher         = new MessageDispatcher(queue, serialisationRegister, messagingMonitor, onError, _handlerMap);

            Subscribers = new Collection <ISubscriber>();
        }
 public MessageDispatcher(
     SqsQueueBase queue,
     IMessageSerializationRegister serializationRegister,
     IMessageMonitor messagingMonitor,
     Action <Exception, SQSMessage> onError,
     HandlerMap handlerMap,
     ILoggerFactory loggerFactory,
     IMessageBackoffStrategy messageBackoffStrategy,
     IMessageContextAccessor messageContextAccessor)
 {
     _queue = queue;
     _serializationRegister = serializationRegister;
     _messagingMonitor      = messagingMonitor;
     _onError                = onError;
     _handlerMap             = handlerMap;
     _logger                 = loggerFactory.CreateLogger("JustSaying");
     _messageBackoffStrategy = messageBackoffStrategy;
     _messageContextAccessor = messageContextAccessor;
 }
Exemple #7
0
        public async Task <bool> IsSubscribedAsync(SqsQueueBase queue)
        {
            var result = await Client.ListSubscriptionsByTopicAsync(new ListSubscriptionsByTopicRequest(Arn));

            return(result.Subscriptions.Any(x => !string.IsNullOrEmpty(x.SubscriptionArn) && x.Endpoint == queue.Arn));
        }
Exemple #8
0
        public bool IsSubscribed(SqsQueueBase queue)
        {
            var result = Client.ListSubscriptionsByTopic(new ListSubscriptionsByTopicRequest(Arn));

            return(result.Subscriptions.Any(x => !string.IsNullOrEmpty(x.SubscriptionArn) && x.Endpoint == queue.Arn));
        }
 public bool IsSubscribed(SqsQueueBase queue)
 {
     var result = Client.ListSubscriptionsByTopic(new ListSubscriptionsByTopicRequest(Arn));
     
     return result.Subscriptions.Any(x => !string.IsNullOrEmpty(x.SubscriptionArn) && x.Endpoint == queue.Arn);
 }
Exemple #10
0
 public Task <bool> SubscribeAsync(SqsQueueBase queue) => SubscribeAsync(queue, CancellationToken.None);