Exemplo n.º 1
0
        private AmazonWebServiceResponse SendMessages(PublishRequestWrapper publishRequest)
        {
            if (!_validatedTopics.ContainsKey(publishRequest.Topic))
            {
                lock (_lockObject)
                {
                    if (!_validatedTopics.ContainsKey(publishRequest.Topic))
                    {
                        var response = Client.CreateTopic(publishRequest.Topic);
                        _validatedTopics.TryAdd(publishRequest.Topic, response.TopicArn);
                    }
                }
            }

            lock (_lockObject)
            {
                string topicArn;
                _validatedTopics.TryGetValue(publishRequest.Topic, out topicArn);

                var request = publishRequest.PublishRequest;
                request.TopicArn = topicArn;
                var sendMessageBatchResponse = Client.Publish(request);
                return(sendMessageBatchResponse);
            }
        }
Exemplo n.º 2
0
 internal void AddPublishRequest(PublishRequestWrapper sendMessageRequest)
 {
     AddRequest(() => SendMessages(sendMessageRequest));
 }