コード例 #1
0
            public async Task CloseAsync(
                AzurePartitionContext context,
                AzureCloseReason reason)
            {
                IEventHubPartitionContext partitionContext =
                    new EventHubPartitionContext(context);
                EventProcessorCloseReason closeReason =
                    reason.ToEventProcessorCloseReason();

                await this.eventProcessor.CloseAsync(
                    partitionContext,
                    closeReason);
            }
コード例 #2
0
        /// <summary>
        /// Convert the Azure EventHubs processor close reason enumeration to
        /// <see cref="EventProcessorCloseReason" /> enumeration.
        /// </summary>
        /// <param name="azureCloseReason">the Azure EventHubs processor close reason enumeration value.</param>
        /// <returns>The <see cref="EventProcessorCloseReason" /> enumeration value.</returns>
        public static EventProcessorCloseReason ToEventProcessorCloseReason(
            this AzureCloseReason azureCloseReason)
        {
            switch (azureCloseReason)
            {
            case AzureCloseReason.LeaseLost:
                return(EventProcessorCloseReason.LeaseLost);

            case AzureCloseReason.Shutdown:
                return(EventProcessorCloseReason.Shutdown);

            default:
                throw new NotSupportedException();
            }
        }