public void Init(Address address, bool transactional)
        {
            useTransactions = transactional;

            var queueName = AzureMessageQueueUtils.GetQueueName(address);

            azureQueue = Client.GetQueueReference(queueName);
            azureQueue.CreateIfNotExists();

            if (PurgeOnStartup)
            {
                azureQueue.Clear();
            }
        }
예제 #2
0
        public void Send(TransportMessage message, Address address)
        {
            var sendClient = GetClientForConnectionString(address.Machine) ?? Client;

            var sendQueue = sendClient.GetQueueReference(AzureMessageQueueUtils.GetQueueName(address));

            if (!sendQueue.Exists())
            {
                throw new QueueNotFoundException();
            }

            var rawMessage = SerializeMessage(message);

            if (Transaction.Current == null)
            {
                sendQueue.AddMessage(rawMessage);
            }
            else
            {
                Transaction.Current.EnlistVolatile(new SendResourceManager(sendQueue, rawMessage), EnlistmentOptions.None);
            }
        }