-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1687 from rabbitmq/rabbitmq-dotnet-client-1682
Track publisher confirmations automatically
- Loading branch information
Showing
52 changed files
with
892 additions
and
858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace RabbitMQ.Client | ||
{ | ||
/// <summary> | ||
/// Channel creation options. | ||
/// </summary> | ||
public sealed class CreateChannelOptions | ||
{ | ||
/// <summary> | ||
/// Enable or disable publisher confirmations on this channel. Defaults to <c>false</c> | ||
/// </summary> | ||
public bool PublisherConfirmationsEnabled { get; set; } = false; | ||
|
||
/// <summary> | ||
/// Should this library track publisher confirmations for you? Defaults to <c>false</c> | ||
/// </summary> | ||
public bool PublisherConfirmationTrackingEnabled { get; set; } = false; | ||
|
||
/// <summary> | ||
/// Set to a value greater than one to enable concurrent processing. For a concurrency greater than one <see cref="IAsyncBasicConsumer"/> | ||
/// will be offloaded to the worker thread pool so it is important to choose the value for the concurrency wisely to avoid thread pool overloading. | ||
/// <see cref="IAsyncBasicConsumer"/> can handle concurrency much more efficiently due to the non-blocking nature of the consumer. | ||
/// | ||
/// Defaults to <c>null</c>, which will use the value from <see cref="IConnectionFactory.ConsumerDispatchConcurrency"/> | ||
/// | ||
/// For concurrency greater than one this removes the guarantee that consumers handle messages in the order they receive them. | ||
/// In addition to that consumers need to be thread/concurrency safe. | ||
/// </summary> | ||
public ushort? ConsumerDispatchConcurrency { get; set; } = null; | ||
|
||
/// <summary> | ||
/// The default channel options. | ||
/// </summary> | ||
public static CreateChannelOptions Default { get; } = new CreateChannelOptions(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// This source code is dual-licensed under the Apache License, version | ||
// 2.0, and the Mozilla Public License, version 2.0. | ||
// | ||
// The APL v2.0: | ||
// | ||
//--------------------------------------------------------------------------- | ||
// Copyright (c) 2007-2024 Broadcom. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
//--------------------------------------------------------------------------- | ||
// | ||
// The MPL v2.0: | ||
// | ||
//--------------------------------------------------------------------------- | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Copyright (c) 2007-2024 Broadcom. All Rights Reserved. | ||
//--------------------------------------------------------------------------- | ||
|
||
using System; | ||
|
||
namespace RabbitMQ.Client.Exceptions | ||
{ | ||
/// <summary> | ||
/// Class for exceptions related to publisher confirmations | ||
/// or the <c>mandatory</c> flag. | ||
/// </summary> | ||
public class PublishException : RabbitMQClientException | ||
{ | ||
private bool _isReturn = false; | ||
private ulong _publishSequenceNumber = ulong.MinValue; | ||
|
||
public PublishException(ulong publishSequenceNumber, bool isReturn) : base() | ||
{ | ||
if (publishSequenceNumber == ulong.MinValue) | ||
{ | ||
throw new ArgumentException($"{nameof(publishSequenceNumber)} must not be 0"); | ||
} | ||
|
||
_isReturn = isReturn; | ||
_publishSequenceNumber = publishSequenceNumber; | ||
} | ||
|
||
/// <summary> | ||
/// <c>true</c> if this exception is due to a <c>basic.return</c> | ||
/// </summary> | ||
public bool IsReturn => _isReturn; | ||
|
||
/// <summary> | ||
/// Retrieve the publish sequence number. | ||
/// </summary> | ||
public ulong PublishSequenceNumber => _publishSequenceNumber; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.