Beispiel #1
0
 /// <summary>
 ///   Creates a producer strongly aligned with the active protocol and transport,
 ///   responsible for publishing <see cref="EventData" /> to the Event Hub.
 /// </summary>
 ///
 /// <param name="partitionId">The identifier of the partition to which the transport producer should be bound; if <c>null</c>, the producer is unbound.</param>
 /// <param name="requestedFeatures">The flags specifying the set of special transport features that should be opted-into.</param>
 /// <param name="partitionOptions">The set of options, if any, that should be considered when initializing the producer.</param>
 /// <param name="retryPolicy">The policy which governs retry behavior and try timeouts.</param>
 ///
 /// <returns>A <see cref="TransportProducer"/> configured in the requested manner.</returns>
 ///
 internal virtual TransportProducer CreateTransportProducer(string partitionId,
                                                            TransportProducerFeatures requestedFeatures,
                                                            PartitionPublishingOptions partitionOptions,
                                                            EventHubsRetryPolicy retryPolicy)
 {
     Argument.AssertNotNull(retryPolicy, nameof(retryPolicy));
     return(InnerClient.CreateProducer(partitionId, requestedFeatures, partitionOptions, retryPolicy));
 }
        /// <summary>
        ///   Creates a consumer strongly aligned with the active protocol and transport, responsible
        ///   for reading <see cref="EventData" /> from a specific Event Hub partition, in the context
        ///   of a specific consumer group.
        ///
        ///   A consumer may be exclusive, which asserts ownership over the partition for the consumer
        ///   group to ensure that only one consumer from that group is reading the from the partition.
        ///   These exclusive consumers are sometimes referred to as "Epoch Consumers."
        ///
        ///   A consumer may also be non-exclusive, allowing multiple consumers from the same consumer
        ///   group to be actively reading events from the partition.  These non-exclusive consumers are
        ///   sometimes referred to as "Non-epoch Consumers."
        ///
        ///   Designating a consumer as exclusive may be specified by setting the <paramref name="ownerLevel" />.
        ///   When <c>null</c>, consumers are created as non-exclusive.
        /// </summary>
        ///
        /// <param name="consumerGroup">The name of the consumer group this consumer is associated with.  Events are read in the context of this group.</param>
        /// <param name="partitionId">The identifier of the Event Hub partition from which events will be received.</param>
        /// <param name="eventPosition">The position within the partition where the consumer should begin reading events.</param>
        /// <param name="retryPolicy">The policy which governs retry behavior and try timeouts.</param>
        /// <param name="trackLastEnqueuedEventProperties">Indicates whether information on the last enqueued event on the partition is sent as events are received.</param>
        /// <param name="ownerLevel">The relative priority to associate with the link; for a non-exclusive link, this value should be <c>null</c>.</param>
        /// <param name="prefetchCount">Controls the number of events received and queued locally without regard to whether an operation was requested.  If <c>null</c> a default will be used.</param>
        ///
        /// <returns>A <see cref="TransportConsumer" /> configured in the requested manner.</returns>
        ///
        internal virtual TransportConsumer CreateTransportConsumer(string consumerGroup,
                                                                   string partitionId,
                                                                   EventPosition eventPosition,
                                                                   EventHubsRetryPolicy retryPolicy,
                                                                   bool trackLastEnqueuedEventProperties = true,
                                                                   long?ownerLevel    = default,
                                                                   uint?prefetchCount = default)
        {
            Argument.AssertNotNullOrEmpty(consumerGroup, nameof(consumerGroup));
            Argument.AssertNotNullOrEmpty(partitionId, nameof(partitionId));
            Argument.AssertNotNull(retryPolicy, nameof(retryPolicy));

            return(InnerClient.CreateConsumer(consumerGroup, partitionId, eventPosition, retryPolicy, trackLastEnqueuedEventProperties, ownerLevel, prefetchCount));
        }
        /// <summary>
        ///   Creates a consumer strongly aligned with the active protocol and transport, responsible
        ///   for reading <see cref="EventData" /> from a specific Event Hub partition, in the context
        ///   of a specific consumer group.
        ///
        ///   A consumer may be exclusive, which asserts ownership over the partition for the consumer
        ///   group to ensure that only one consumer from that group is reading the from the partition.
        ///   These exclusive consumers are sometimes referred to as "Epoch Consumers."
        ///
        ///   A consumer may also be non-exclusive, allowing multiple consumers from the same consumer
        ///   group to be actively reading events from the partition.  These non-exclusive consumers are
        ///   sometimes referred to as "Non-epoch Consumers."
        ///
        ///   Designating a consumer as exclusive may be specified by setting the <paramref name="ownerLevel" />.
        ///   When <c>null</c>, consumers are created as non-exclusive.
        /// </summary>
        ///
        /// <param name="consumerGroup">The name of the consumer group this consumer is associated with.  Events are read in the context of this group.</param>
        /// <param name="partitionId">The identifier of the Event Hub partition from which events will be received.</param>
        /// <param name="consumerIdentifier">The identifier to associate with the consumer; if <c>null</c> or <see cref="string.Empty" />, a random identifier will be generated.</param>
        /// <param name="eventPosition">The position within the partition where the consumer should begin reading events.</param>
        /// <param name="retryPolicy">The policy which governs retry behavior and try timeouts.</param>
        /// <param name="trackLastEnqueuedEventProperties">Indicates whether information on the last enqueued event on the partition is sent as events are received.</param>
        /// <param name="invalidateConsumerWhenPartitionStolen">Indicates whether or not the consumer should consider itself invalid when a partition is stolen.</param>
        /// <param name="ownerLevel">The relative priority to associate with the link; for a non-exclusive link, this value should be <c>null</c>.</param>
        /// <param name="prefetchCount">Controls the number of events received and queued locally without regard to whether an operation was requested.  If <c>null</c> a default will be used.</param>
        /// <param name="prefetchSizeInBytes">The cache size of the prefetch queue. When set, the link makes a best effort to ensure prefetched messages fit into the specified size.</param>
        ///
        /// <returns>A <see cref="TransportConsumer" /> configured in the requested manner.</returns>
        ///
        internal virtual TransportConsumer CreateTransportConsumer(string consumerGroup,
                                                                   string partitionId,
                                                                   string consumerIdentifier,
                                                                   EventPosition eventPosition,
                                                                   EventHubsRetryPolicy retryPolicy,
                                                                   bool trackLastEnqueuedEventProperties      = true,
                                                                   bool invalidateConsumerWhenPartitionStolen = false,
                                                                   long?ownerLevel          = default,
                                                                   uint?prefetchCount       = default,
                                                                   long?prefetchSizeInBytes = default)
        {
            Argument.AssertNotNullOrEmpty(consumerGroup, nameof(consumerGroup));
            Argument.AssertNotNullOrEmpty(partitionId, nameof(partitionId));
            Argument.AssertNotNull(retryPolicy, nameof(retryPolicy));

            return(InnerClient.CreateConsumer(consumerGroup, partitionId, consumerIdentifier, eventPosition, retryPolicy, trackLastEnqueuedEventProperties, invalidateConsumerWhenPartitionStolen, ownerLevel, prefetchCount, prefetchSizeInBytes));
        }
 /// <summary>
 ///   Creates a producer strongly aligned with the active protocol and transport,
 ///   responsible for publishing <see cref="EventData" /> to the Event Hub.
 /// </summary>
 ///
 /// <param name="partitionId">The identifier of the partition to which the transport producer should be bound; if <c>null</c>, the producer is unbound.</param>
 /// <param name="retryPolicy">The policy which governs retry behavior and try timeouts.</param>
 ///
 /// <returns>A <see cref="TransportProducer"/> configured in the requested manner.</returns>
 ///
 internal virtual TransportProducer CreateTransportProducer(string partitionId,
                                                            EventHubsRetryPolicy retryPolicy)
 {
     Argument.AssertNotNull(retryPolicy, nameof(retryPolicy));
     return(InnerClient.CreateProducer(partitionId, retryPolicy));
 }
 /// <summary>
 ///   Retrieves information about a specific partition for an Event Hub, including elements that describe the available
 ///   events in the partition event stream.
 /// </summary>
 ///
 /// <param name="partitionId">The unique identifier of a partition associated with the Event Hub.</param>
 /// <param name="retryPolicy">The retry policy to use as the basis for retrieving the information.</param>
 /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
 ///
 /// <returns>The set of information for the requested partition under the Event Hub this connection is associated with.</returns>
 ///
 internal virtual Task <PartitionProperties> GetPartitionPropertiesAsync(string partitionId,
                                                                         EventHubsRetryPolicy retryPolicy,
                                                                         CancellationToken cancellationToken = default) => InnerClient.GetPartitionPropertiesAsync(partitionId, retryPolicy, cancellationToken);
 /// <summary>
 ///   Retrieves the set of identifiers for the partitions of an Event Hub.
 /// </summary>
 ///
 /// <param name="retryPolicy">The retry policy to use as the basis for retrieving the information.</param>
 /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
 ///
 /// <returns>The set of identifiers for the partitions within the Event Hub that this connection is associated with.</returns>
 ///
 /// <remarks>
 ///   This method is synonymous with invoking <see cref="GetPropertiesAsync(EventHubsRetryPolicy, CancellationToken)" /> and reading the <see cref="EventHubProperties.PartitionIds"/>
 ///   property that is returned. It is offered as a convenience for quick access to the set of partition identifiers for the associated Event Hub.
 ///   No new or extended information is presented.
 /// </remarks>
 ///
 internal virtual async Task <string[]> GetPartitionIdsAsync(EventHubsRetryPolicy retryPolicy,
                                                             CancellationToken cancellationToken = default) =>
 (await GetPropertiesAsync(retryPolicy, cancellationToken).ConfigureAwait(false)).PartitionIds;
 /// <summary>
 ///   Retrieves information about the Event Hub that the connection is associated with, including
 ///   the number of partitions present and their identifiers.
 /// </summary>
 ///
 /// <param name="retryPolicy">The retry policy to use as the basis for retrieving the information.</param>
 /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
 ///
 /// <returns>The set of information for the Event Hub that this connection is associated with.</returns>
 ///
 internal virtual Task <EventHubProperties> GetPropertiesAsync(EventHubsRetryPolicy retryPolicy,
                                                               CancellationToken cancellationToken = default) => InnerClient.GetPropertiesAsync(retryPolicy, cancellationToken);
Beispiel #8
0
 /// <summary>
 ///   Retrieves information about a specific partition for an Event Hub, including elements that describe the available
 ///   events in the partition event stream.
 /// </summary>
 ///
 /// <param name="partitionId">The unique identifier of a partition associated with the Event Hub.</param>
 /// <param name="retryPolicy">The retry policy to use as the basis for retrieving the information.</param>
 /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
 ///
 /// <returns>The set of information for the requested partition under the Event Hub this connection is associated with.</returns>
 ///
 internal virtual async Task <PartitionProperties> GetPartitionPropertiesAsync(string partitionId,
                                                                               EventHubsRetryPolicy retryPolicy,
                                                                               CancellationToken cancellationToken = default) => await InnerClient.GetPartitionPropertiesAsync(partitionId, retryPolicy, cancellationToken).ConfigureAwait(false);
Beispiel #9
0
 /// <summary>
 ///   Retrieves information about the Event Hub that the connection is associated with, including
 ///   the number of partitions present and their identifiers.
 /// </summary>
 ///
 /// <param name="retryPolicy">The retry policy to use as the basis for retrieving the information.</param>
 /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
 ///
 /// <returns>The set of information for the Event Hub that this connection is associated with.</returns>
 ///
 internal virtual async Task <EventHubProperties> GetPropertiesAsync(EventHubsRetryPolicy retryPolicy,
                                                                     CancellationToken cancellationToken = default) => await InnerClient.GetPropertiesAsync(retryPolicy, cancellationToken).ConfigureAwait(false);