示例#1
0
        public SbReceiver(string NamespaceConnectionString, string QueueName, bool ReceiveFromDeadLetter, ISbManager sbManager, bool PurgeMode = false)
        {
            tokenCancel = new CancellationTokenSource();

            ReceiveMode receiveMode = ReceiveMode.PeekLock;

            if (PurgeMode)
            {
                receiveMode = ReceiveMode.ReceiveAndDelete;
            }

            if (sbManager.QueueOrTopicExists(QueueName, SbEntityTypes.Queue))
            {
                string entityPath = QueueName;

                if (ReceiveFromDeadLetter)
                {
                    entityPath = sbManager.BuildDeadLetterPath(QueueName);
                }

                this.messageReceiver = CreateMessageReceiver(NamespaceConnectionString, entityPath, receiveMode);
            }
            else
            {
                throw new NonExistentEntityException(String.Format("{0} {1} does not exist", SbEntityTypes.Queue, QueueName));
            }
        }
示例#2
0
 public SbSender(string NamespaceConnectionString, string EntityPath, SbEntityTypes EntityType, ISbManager sbManager)
 {
     if (sbManager.QueueOrTopicExists(EntityPath, EntityType))
     {
         this.messageSender = new MessageSender(NamespaceConnectionString, EntityPath, null);
         this.messageSender.ServiceBusConnection.TransportType = TransportType.AmqpWebSockets;
     }
     else
     {
         throw new NonExistentEntityException(String.Format("{0} {1} does not exist", EntityType, EntityPath));
     }
 }