Exemplo n.º 1
0
        public void Init(Address address, bool transactional)
        {
            try
            {
                queueName = address.Queue;
                var description = new QueueDescription {RequiresSession = false, RequiresDuplicateDetection = false, MaxQueueSizeInBytes = 104857600};
                namespaceClient.CreateQueue(queueName, description);
            }
            catch (MessagingEntityAlreadyExistsException)
            {
                // the queue already exists, which is ok
            }

            queueClient = factory.CreateQueueClient(queueName);
            receiver = queueClient.CreateReceiver(ReceiveMode.PeekLock);
            receiver.Faulted += (o, args) => receiver = queueClient.CreateReceiver(ReceiveMode.PeekLock);

            useTransactions = transactional;
        }