Ejemplo n.º 1
0
 private EventHubReceiver(Microsoft.ServiceBus.Messaging.MessagingFactory factory, string path, string consumerName, string partitionId, long?epoch, bool offsetInclusive)
 {
     if (factory == null)
     {
         throw Fx.Exception.ArgumentNull("factory");
     }
     if (partitionId == null)
     {
         throw Fx.Exception.ArgumentNull("partitionId");
     }
     if (string.IsNullOrWhiteSpace(path))
     {
         throw Fx.Exception.ArgumentNullOrWhiteSpace("path");
     }
     this.Name = consumerName;
     if (string.IsNullOrWhiteSpace(consumerName))
     {
         this.Name = "$Default";
     }
     this.EventHubPath     = path;
     this.MessagingFactory = factory;
     this.PartitionId      = partitionId;
     base.RetryPolicy      = factory.RetryPolicy.Clone();
     this.Epoch            = epoch;
     this.OffsetInclusive  = offsetInclusive;
 }
Ejemplo n.º 2
0
 internal MessageBrowser(Microsoft.ServiceBus.Messaging.MessagingFactory messagingFactory, Microsoft.ServiceBus.RetryPolicy retryPolicy)
 {
     this.MessagingFactory         = messagingFactory;
     this.operationTimeout         = messagingFactory.OperationTimeout;
     this.lastPeekedSequenceNumber = Constants.DefaultLastPeekedSequenceNumber;
     base.RetryPolicy     = retryPolicy ?? messagingFactory.RetryPolicy.Clone();
     this.openOnceManager = new OpenOnceManager(this);
 }
Ejemplo n.º 3
0
 internal EventHubClient(Microsoft.ServiceBus.Messaging.MessagingFactory messagingFactory, string path)
 {
     this.MessagingFactory    = messagingFactory;
     this.cachedSettings      = new Lazy <MessagingFactorySettings>(new Func <MessagingFactorySettings>(this.MessagingFactory.GetSettings));
     base.ClientEntityManager = new MessageClientEntityManager();
     this.Path          = path;
     base.RetryPolicy   = messagingFactory.RetryPolicy.Clone();
     this.PrefetchCount = Constants.DefaultEventHubPrefetchCount;
 }
Ejemplo n.º 4
0
 internal TopicClient(Microsoft.ServiceBus.Messaging.MessagingFactory messagingFactory, string path)
 {
     this.MessagingFactory    = messagingFactory;
     this.Path                = path;
     this.openOnceManager     = new OpenOnceManager(this);
     base.ClientEntityManager = new MessageClientEntityManager();
     this.IsSubQueue          = MessagingUtilities.IsSubQueue(path);
     base.RetryPolicy         = messagingFactory.RetryPolicy.Clone();
 }
 internal EventHubConsumerGroup(Microsoft.ServiceBus.Messaging.MessagingFactory messagingFactory, string eventHubPath, string groupName, int prefetchCount)
 {
     this.MessagingFactory    = messagingFactory;
     base.ClientEntityManager = new MessageClientEntityManager();
     this.handlers            = new ConcurrentDictionary <Lease, EventProcessorLifecycleManager>();
     this.EventHubPath        = eventHubPath;
     this.GroupName           = groupName;
     base.RetryPolicy         = messagingFactory.RetryPolicy.Clone();
     this.PrefetchCount       = prefetchCount;
 }
 protected VolatileTopicClient(Microsoft.ServiceBus.Messaging.MessagingFactory messagingFactory, string path, string clientId, Microsoft.ServiceBus.RetryPolicy retryPolicy, Microsoft.ServiceBus.Messaging.Filter filter)
 {
     this.MessagingFactory    = messagingFactory;
     base.ClientEntityManager = new MessageClientEntityManager();
     this.openOnceManager     = new OpenOnceManager(this);
     this.Path        = path;
     this.ClientId    = (string.IsNullOrEmpty(clientId) ? Guid.NewGuid().ToString() : clientId);
     base.RetryPolicy = retryPolicy;
     this.Filter      = filter;
 }
Ejemplo n.º 7
0
 internal EventHubSender(Microsoft.ServiceBus.Messaging.MessagingFactory factory, string path, string partitionId)
 {
     if (factory == null)
     {
         throw Fx.Exception.ArgumentNull("factory");
     }
     if (string.IsNullOrWhiteSpace(path))
     {
         throw Fx.Exception.ArgumentNullOrWhiteSpace("path");
     }
     this.Path             = path;
     this.PartitionId      = partitionId;
     this.MessagingFactory = factory;
     base.RetryPolicy      = factory.RetryPolicy.Clone();
 }
Ejemplo n.º 8
0
        private void EnsureCreateInternalReceiver()
        {
            MessageReceiver result;

            base.ThrowIfDisposed();
            if (this.InternalReceiver == null)
            {
                lock (base.ThisLock)
                {
                    if (this.InternalReceiver == null)
                    {
                        try
                        {
                            ReceiveMode receiveMode = ReceiveMode.ReceiveAndDelete;
                            if (string.IsNullOrWhiteSpace(this.StartingOffset) && !this.StartingDateTimeUtc.HasValue)
                            {
                                receiveMode = ReceiveMode.PeekLock;
                            }
                            if (this.StartingDateTimeUtc.HasValue)
                            {
                                Microsoft.ServiceBus.Messaging.MessagingFactory messagingFactory = this.MessagingFactory;
                                string   eventHubPath        = this.EventHubPath;
                                string   name                = this.Name;
                                string   partitionId         = this.PartitionId;
                                DateTime?startingDateTimeUtc = this.StartingDateTimeUtc;
                                result = messagingFactory.CreateReceiverAsync(eventHubPath, name, receiveMode, partitionId, startingDateTimeUtc.Value, this.Epoch).Result;
                            }
                            else
                            {
                                result = this.MessagingFactory.CreateReceiverAsync(this.EventHubPath, this.Name, receiveMode, this.PartitionId, EventHubReceiver.GetValueOrDefaultOffset(this.StartingOffset), this.OffsetInclusive, this.Epoch).Result;
                            }
                            this.InternalReceiver = result;
                            this.InternalReceiver.PrefetchCount = this.PrefetchCount;
                            this.InternalReceiver.RetryPolicy   = base.RetryPolicy;
                            this.InternalReceiver.EntityType    = new MessagingEntityType?(MessagingEntityType.ConsumerGroup);
                        }
                        catch (AggregateException aggregateException)
                        {
                            throw aggregateException.Flatten().InnerException;
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
 public MessagingFactory(Uri serviceBusUri, TokenProvider tokenProvider)
 {
     this.messagingFactoryCore = Microsoft.ServiceBus.Messaging.MessagingFactory.Create(serviceBusUri, tokenProvider);
 }
Ejemplo n.º 10
0
 internal EventHubReceiver(Microsoft.ServiceBus.Messaging.MessagingFactory factory, string path, string consumerName, string startingOffset, string partitionId, int prefetchCount, long?epoch, bool offsetInclusive) : this(factory, path, consumerName, partitionId, epoch, offsetInclusive)
 {
     this.StartingOffset = startingOffset;
     this.PrefetchCount  = prefetchCount;
 }
Ejemplo n.º 11
0
 internal EventHubReceiver(Microsoft.ServiceBus.Messaging.MessagingFactory factory, string path, string consumerName, DateTime?startingDateTimeUtc, string partitionId, int prefetchCount, long?epoch) : this(factory, path, consumerName, partitionId, epoch, false)
 {
     this.StartingDateTimeUtc = startingDateTimeUtc;
     this.PrefetchCount       = prefetchCount;
 }
Ejemplo n.º 12
0
 internal MessageSession(ReceiveMode receiveMode, string sessionId, DateTime lockedUntilUtc, Microsoft.ServiceBus.Messaging.MessagingFactory messagingFactory, Microsoft.ServiceBus.RetryPolicy retryPolicy) : base(messagingFactory, retryPolicy, receiveMode, null)
 {
     this.SessionId      = sessionId;
     this.LockedUntilUtc = lockedUntilUtc;
 }