Skip to content

Commit 19471e2

Browse files
Revert "Merge branch 'bollhals-batchpublishsizehint'"
This reverts commit 0be2d4a. The Church of Strict Semantic Versioning does not approve any interface modifications except for major versions. Le sigh.
1 parent 0be2d4a commit 19471e2

File tree

6 files changed

+4
-66
lines changed

6 files changed

+4
-66
lines changed

projects/RabbitMQ.Client/client/api/IModel.cs

-6
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,6 @@ void BasicPublish(string exchange, string routingKey, bool mandatory,
291291
[AmqpMethodDoNotImplement(null)]
292292
IBasicPublishBatch CreateBasicPublishBatch();
293293

294-
/// <summary>
295-
/// Creates a BasicPublishBatch instance
296-
/// </summary>
297-
[AmqpMethodDoNotImplement(null)]
298-
IBasicPublishBatch CreateBasicPublishBatch(int sizeHint);
299-
300294
/// <summary>
301295
/// Construct a completely empty content header for use with the Basic content class.
302296
/// </summary>

projects/RabbitMQ.Client/client/impl/AutorecoveringModel.cs

-10
Original file line numberDiff line numberDiff line change
@@ -1960,15 +1960,5 @@ public IBasicPublishBatch CreateBasicPublishBatch()
19601960

19611961
return ((IFullModel)_delegate).CreateBasicPublishBatch();
19621962
}
1963-
1964-
public IBasicPublishBatch CreateBasicPublishBatch(int sizeHint)
1965-
{
1966-
if (_disposed)
1967-
{
1968-
throw new ObjectDisposedException(GetType().FullName);
1969-
}
1970-
1971-
return ((IFullModel)_delegate).CreateBasicPublishBatch(sizeHint);
1972-
}
19731963
}
19741964
}

projects/RabbitMQ.Client/client/impl/BasicPublishBatch.cs

+4-10
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,21 @@
3838
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
3939
//---------------------------------------------------------------------------
4040

41+
using System;
42+
using System.Buffers;
4143
using System.Collections.Generic;
4244

4345
using RabbitMQ.Client.Framing.Impl;
4446

4547
namespace RabbitMQ.Client.Impl
4648
{
47-
internal sealed class BasicPublishBatch : IBasicPublishBatch
49+
class BasicPublishBatch : IBasicPublishBatch
4850
{
49-
private readonly List<Command> _commands;
51+
private readonly List<Command> _commands = new List<Command>();
5052
private readonly ModelBase _model;
51-
5253
internal BasicPublishBatch (ModelBase model)
5354
{
5455
_model = model;
55-
_commands = new List<Command>();
56-
}
57-
58-
internal BasicPublishBatch (ModelBase model, int sizeHint)
59-
{
60-
_model = model;
61-
_commands = new List<Command>(sizeHint);
6256
}
6357

6458
public void Add(string exchange, string routingKey, bool mandatory, IBasicProperties basicProperties, byte[] body)

projects/RabbitMQ.Client/client/impl/ModelBase.cs

-5
Original file line numberDiff line numberDiff line change
@@ -1203,11 +1203,6 @@ public IBasicPublishBatch CreateBasicPublishBatch()
12031203
return new BasicPublishBatch(this);
12041204
}
12051205

1206-
public IBasicPublishBatch CreateBasicPublishBatch(int sizeHint)
1207-
{
1208-
return new BasicPublishBatch(this, sizeHint);
1209-
}
1210-
12111206

12121207
public void ExchangeBind(string destination,
12131208
string source,

projects/Unit/APIApproval.Approve.verified.txt

-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ namespace RabbitMQ.Client
398398
uint ConsumerCount(string queue);
399399
RabbitMQ.Client.IBasicProperties CreateBasicProperties();
400400
RabbitMQ.Client.IBasicPublishBatch CreateBasicPublishBatch();
401-
RabbitMQ.Client.IBasicPublishBatch CreateBasicPublishBatch(int sizeHint);
402401
void ExchangeBind(string destination, string source, string routingKey, System.Collections.Generic.IDictionary<string, object> arguments);
403402
void ExchangeBindNoWait(string destination, string source, string routingKey, System.Collections.Generic.IDictionary<string, object> arguments);
404403
void ExchangeDeclare(string exchange, string type, bool durable, bool autoDelete, System.Collections.Generic.IDictionary<string, object> arguments);

projects/Unit/TestBasicPublishBatch.cs

-34
Original file line numberDiff line numberDiff line change
@@ -62,39 +62,5 @@ public void TestBasicPublishBatchSend()
6262
BasicGetResult resultB = Model.BasicGet("test-message-batch-b", true);
6363
Assert.NotNull(resultB);
6464
}
65-
66-
[Test]
67-
public void TestBasicPublishBatchSendWithSizeHint()
68-
{
69-
Model.ConfirmSelect();
70-
Model.QueueDeclare(queue: "test-message-batch-a", durable: false);
71-
Model.QueueDeclare(queue: "test-message-batch-b", durable: false);
72-
IBasicPublishBatch batch = Model.CreateBasicPublishBatch(2);
73-
batch.Add("", "test-message-batch-a", false, null, new byte [] {});
74-
batch.Add("", "test-message-batch-b", false, null, new byte [] {});
75-
batch.Publish();
76-
Model.WaitForConfirmsOrDie(TimeSpan.FromSeconds(15));
77-
BasicGetResult resultA = Model.BasicGet("test-message-batch-a", true);
78-
Assert.NotNull(resultA);
79-
BasicGetResult resultB = Model.BasicGet("test-message-batch-b", true);
80-
Assert.NotNull(resultB);
81-
}
82-
83-
[Test]
84-
public void TestBasicPublishBatchSendWithWrongSizeHint()
85-
{
86-
Model.ConfirmSelect();
87-
Model.QueueDeclare(queue: "test-message-batch-a", durable: false);
88-
Model.QueueDeclare(queue: "test-message-batch-b", durable: false);
89-
IBasicPublishBatch batch = Model.CreateBasicPublishBatch(1);
90-
batch.Add("", "test-message-batch-a", false, null, new byte [] {});
91-
batch.Add("", "test-message-batch-b", false, null, new byte [] {});
92-
batch.Publish();
93-
Model.WaitForConfirmsOrDie(TimeSpan.FromSeconds(15));
94-
BasicGetResult resultA = Model.BasicGet("test-message-batch-a", true);
95-
Assert.NotNull(resultA);
96-
BasicGetResult resultB = Model.BasicGet("test-message-batch-b", true);
97-
Assert.NotNull(resultB);
98-
}
9965
}
10066
}

0 commit comments

Comments
 (0)