Skip to content

Commit 5f7adba

Browse files
Jalal Amini Robatilukebakken
authored andcommitted
add DeliveryModes convenience class
change NonPersistent const name in DeliveryModes to Transient
1 parent d4b49cf commit 5f7adba

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 2.0.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (c) 2007-2020 VMware, Inc.
8+
//
9+
// Licensed under the Apache License, Version 2.0 (the "License");
10+
// you may not use this file except in compliance with the License.
11+
// You may obtain a copy of the License at
12+
//
13+
// https://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing, software
16+
// distributed under the License is distributed on an "AS IS" BASIS,
17+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
// See the License for the specific language governing permissions and
19+
// limitations under the License.
20+
//---------------------------------------------------------------------------
21+
//
22+
// The MPL v2.0:
23+
//
24+
//---------------------------------------------------------------------------
25+
// This Source Code Form is subject to the terms of the Mozilla Public
26+
// License, v. 2.0. If a copy of the MPL was not distributed with this
27+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
28+
//
29+
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
30+
//---------------------------------------------------------------------------
31+
32+
namespace RabbitMQ.Client
33+
{
34+
/// <summary>
35+
/// Convenience class providing compile-time names for persistent modes.
36+
/// </summary>
37+
public static class DeliveryModes
38+
{
39+
/// <summary>
40+
/// Value for transient delivery mode (not durable).
41+
/// </summary>
42+
public const byte Transient = 1;
43+
44+
/// <summary>
45+
/// Value for persistent delivery mode (durable).
46+
/// </summary>
47+
public const byte Persistent = 2;
48+
}
49+
}

projects/Unit/TestBasicProperties.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void TestPersistentPropertyChangesDeliveryMode_PersistentTrueDelivery2()
4848
};
4949

5050
// Assert
51-
Assert.Equal(2, subject.DeliveryMode);
51+
Assert.Equal(DeliveryModes.Persistent, subject.DeliveryMode);
5252
Assert.True(subject.Persistent);
5353

5454
Span<byte> span = new byte[1024];
@@ -79,7 +79,7 @@ public void TestPersistentPropertyChangesDeliveryMode_PersistentFalseDelivery1()
7979
};
8080

8181
// Assert
82-
Assert.Equal(1, subject.DeliveryMode);
82+
Assert.Equal(DeliveryModes.Transient, subject.DeliveryMode);
8383
Assert.False(subject.Persistent);
8484

8585
Span<byte> span = new byte[1024];

projects/Unit/TestContentHeaderCodec.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void TestFullProperties()
8484
ContentEncoding = "C",
8585
ClusterId = "D",
8686
CorrelationId = "E",
87-
DeliveryMode = 1,
87+
DeliveryMode = DeliveryModes.Transient,
8888
Expiration = "F",
8989
MessageId = "G",
9090
Priority = 2,

0 commit comments

Comments
 (0)