public override IMessageQueue GetResponseQueue()
        {
            if (!(Connection.Pattern == MessagePattern.RequestResponse && Connection.Direction == Direction.Outbound))
            {
                throw new InvalidOperationException("Cannot get a response queue except for outbound request-response");
            }

            if (ResponseQueue != null)
            {
                return(ResponseQueue);
            }

            var queueName  = $"{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}-{Guid.NewGuid().ToString("D")}";
            var connection = new AzureMessageQueueConnection {
                Name = queueName, Endpoint = AzureConnection.Endpoint, Direction = Direction.Inbound, Pattern = MessagePattern.RequestResponse
            };

            ResponseQueue = QueueFactory.Create(connection);

            return(ResponseQueue);
        }
        public AzureMessageQueue(AzureMessageQueueConnection connection, IMessageQueueFactory queueFactory)
            : base(connection, queueFactory)
        {
            AzureConnection = connection;

            switch (connection.Pattern)
            {
            case MessagePattern.PublishSubscribe:
                if (connection.Direction == Direction.Inbound)
                {
                    Queue = new AzureSubscriptionClient(connection);
                }
                else
                {
                    Queue = new AzureTopicClient(connection);
                }
                break;

            default:
                Queue = new AzureQueueClient(connection);
                break;
            }
        }
 public AzureTopicClient(AzureMessageQueueConnection connection)
 {
     _client = TopicClient.CreateFromConnectionString(connection.Endpoint, connection.Name);
 }
Exemple #4
0
 public AzureSubscriptionClient(AzureMessageQueueConnection connection)
 {
     _client = SubscriptionClient.CreateFromConnectionString(connection.Endpoint, connection.Name, connection.Subscription);
 }
 public AzureTopicClient(AzureMessageQueueConnection connection)
 {
     _client = TopicClient.CreateFromConnectionString(connection.Endpoint, connection.Name);
 }
 public AzureSubscriptionClient(AzureMessageQueueConnection connection)
 {
     _client = SubscriptionClient.CreateFromConnectionString(connection.Endpoint, connection.Name, connection.Subscription);
 }