Example #1
0
        /// <summary>
        /// Creates a <see cref="ServiceBusReceiver"/> instance that can be used for receiving from the
        /// dead letter queue for the specified queue.
        /// </summary>
        ///
        /// <param name="queueName">The queue to create a <see cref="ServiceBusReceiver"/> for.</param>
        /// <param name="options">The set of <see cref="ServiceBusReceiverOptions"/> to use for configuring the
        /// <see cref="ServiceBusReceiver"/>.</param>
        ///
        /// <returns>A <see cref="ServiceBusReceiver"/> scoped to the dead letter queue of the specified
        /// queue.</returns>
        public ServiceBusReceiver CreateDeadLetterReceiver(
            string queueName,
            ServiceBusReceiverOptions options = default)
        {
            ValidateEntityName(queueName);

            return(new ServiceBusReceiver(
                       connection: Connection,
                       entityPath: EntityNameFormatter.FormatDeadLetterPath(queueName),
                       isSessionEntity: false,
                       options: options));
        }
Example #2
0
        /// <summary>
        /// Creates a <see cref="ServiceBusReceiver"/> instance that can be used for receiving from the
        /// dead letter queue for the specified subscription.
        /// </summary>
        ///
        /// <param name="topicName">The topic to create a <see cref="ServiceBusReceiver"/> for.</param>
        /// <param name="subscriptionName">The subscription to create a <see cref="ServiceBusReceiver"/> for.</param>
        /// <param name="options">The set of <see cref="ServiceBusReceiverOptions"/> to use for configuring the
        /// <see cref="ServiceBusReceiver"/>.</param>
        ///
        /// <returns>A <see cref="ServiceBusReceiver"/> scoped to the dead letter queue of the specified
        /// queue.</returns>
        public ServiceBusReceiver CreateDeadLetterReceiver(
            string topicName,
            string subscriptionName,
            ServiceBusReceiverOptions options = default)
        {
            ValidateEntityName(topicName);

            return(new ServiceBusReceiver(
                       connection: Connection,
                       entityPath: EntityNameFormatter.FormatDeadLetterPath(
                           EntityNameFormatter.FormatSubscriptionPath(
                               topicName,
                               subscriptionName)),
                       isSessionEntity: false,
                       options: options));
        }