Skip to content

Commit dc0e389

Browse files
Merge pull request #88 from Pliner/fix_#52
Fix #52
2 parents 29f77f7 + 17d33f6 commit dc0e389

File tree

3 files changed

+106
-2
lines changed

3 files changed

+106
-2
lines changed

projects/client/RabbitMQ.Client/RabbitMQ.Client.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
<Compile Include="src\client\api\ConnectionFactory.cs" />
131131
<Compile Include="src\client\api\ConnectionFactoryBase.cs" />
132132
<Compile Include="src\client\api\DefaultBasicConsumer.cs" />
133+
<Compile Include="src\client\api\Headers.cs" />
133134
<Compile Include="src\client\api\ExchangeType.cs" />
134135
<Compile Include="src\client\api\ExternalMechanism.cs" />
135136
<Compile Include="src\client\api\ExternalMechanismFactory.cs" />
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2014 GoPivotal, 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+
// http://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 v1.1:
23+
//
24+
//---------------------------------------------------------------------------
25+
// The contents of this file are subject to the Mozilla Public License
26+
// Version 1.1 (the "License"); you may not use this file except in
27+
// compliance with the License. You may obtain a copy of the License
28+
// at http://www.mozilla.org/MPL/
29+
//
30+
// Software distributed under the License is distributed on an "AS IS"
31+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
32+
// the License for the specific language governing rights and
33+
// limitations under the License.
34+
//
35+
// The Original Code is RabbitMQ.
36+
//
37+
// The Initial Developer of the Original Code is GoPivotal, Inc.
38+
// Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
using System.Collections.Generic;
42+
43+
namespace RabbitMQ.Client
44+
{
45+
/// <summary>
46+
/// Convenience class providing compile-time names for standard headers.
47+
/// </summary>
48+
/// <remarks>
49+
/// Use the static members of this class as headers for the
50+
/// arguments for Queue and Exchange declaration or Consumer creation.
51+
/// The broker may be extended with additional
52+
/// headers that do not appear in this class.
53+
/// </remarks>
54+
public static class Headers
55+
{
56+
/// <summary>
57+
/// Header used to declare priority queues and set maximum priority of a queue
58+
/// </summary>
59+
public const string QueueMaxPriority = "x-max-priority";
60+
61+
/// <summary>
62+
/// Header used to limit maximum length of a queue in messages
63+
/// </summary>
64+
public const string QueueMaxLengthInMessages = "x-max-length";
65+
66+
/// <summary>
67+
/// Header used to limit maximum length of a queue in bytes
68+
/// </summary>
69+
public const string QueueMaxLengthInBytes = "x-max-length-bytes";
70+
71+
/// <summary>
72+
/// Header used to set dead letter exchange for a queue
73+
/// </summary>
74+
public const string DeadLetterExchange = "x-dead-letter-exchange";
75+
76+
/// <summary>
77+
/// Header used to set dead letter routing key for a queue
78+
/// </summary>
79+
public const string DeadLetterRoutingKey = "x-dead-letter-routing-key";
80+
81+
/// <summary>
82+
/// Header used to set ttl globaly to all messages in a queue
83+
/// </summary>
84+
public const string PerQueueMessageTtl = "x-message-ttl";
85+
86+
/// <summary>
87+
/// Header used to set expiration for a queue
88+
/// </summary>
89+
public const string QueueExpires = "x-expires";
90+
91+
92+
/// <summary>
93+
/// Header used to set alternate exchange for an exchange
94+
/// </summary>
95+
public const string AlternateExchange = "alternate-exchange";
96+
97+
98+
/// <summary>
99+
/// Header used to set priority of consumer
100+
/// </summary>
101+
public const string ConsumerPriority = "x-priority";
102+
}
103+
}

projects/client/Unit/src/unit/TestMessagePatternsSubscription.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected void TestConcurrentIterationWithDrainer(Action<Subscription> action)
5555
{
5656
IDictionary<string, object> args = new Dictionary<string, object>
5757
{
58-
{"x-message-ttl", 5000}
58+
{Headers.PerQueueMessageTtl, 5000}
5959
};
6060
string queueDeclare = Model.QueueDeclare("", false, true, false, args);
6161
var subscription = new Subscription(Model, queueDeclare, false);
@@ -78,7 +78,7 @@ protected void TestSequentialIterationWithDrainer(Action<Subscription> action)
7878
{
7979
IDictionary<string, object> args = new Dictionary<string, object>
8080
{
81-
{"x-message-ttl", 5000}
81+
{Headers.PerQueueMessageTtl, 5000}
8282
};
8383
string queueDeclare = Model.QueueDeclare("", false, true, false, args);
8484
var subscription = new Subscription(Model, queueDeclare, false);

0 commit comments

Comments
 (0)