Skip to content

Commit 6d39db4

Browse files
authored
Merge pull request #1144 from rabbitmq/rabbitmq-dotnet-client-1141-7.x
Merge pull request #1141 from rabbitmq/lukebakken/fix-appveyor
2 parents 1e08a3c + 96cf0ac commit 6d39db4

File tree

12 files changed

+219
-232
lines changed

12 files changed

+219
-232
lines changed

.travis.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

appveyor.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ version: "7.0.0.{build}"
33
platform: Any CPU
44
configuration: Release
55
skip_tags: true
6-
skip_branch_with_pr: true
76
image: Visual Studio 2019
87

98
cache:
109
# Note: this must match the $rabbitmq_installer_path and $erlang_installer_path values in
1110
# tools\appveyor\install.ps1
12-
- "%HOMEDRIVE%%HOMEPATH%\\rabbitmq-server-3.8.9.exe"
13-
- "%HOMEDRIVE%%HOMEPATH%\\otp_win64_23.1.2.exe"
11+
- "%HOMEDRIVE%%HOMEPATH%\\rabbitmq-server-3.9.13.exe"
12+
- "%HOMEDRIVE%%HOMEPATH%\\otp_win64_24.2.1.exe"
1413

1514
install:
1615
- ps: .\tools\appveyor\install.ps1

build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@ECHO OFF
22
set DOTNET_CLI_TELEMETRY_OPTOUT=1
33
dotnet restore .\RabbitMQDotNetClient.sln
4-
dotnet run -p .\projects\Apigen\Apigen.csproj --apiName:AMQP_0_9_1 .\projects\specs\amqp0-9-1.stripped.xml .\gensrc\autogenerated-api-0-9-1.cs
4+
dotnet run --project .\projects\Apigen\Apigen.csproj --apiName:AMQP_0_9_1 .\projects\specs\amqp0-9-1.stripped.xml .\gensrc\autogenerated-api-0-9-1.cs
55
dotnet build .\RabbitMQDotNetClient.sln

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fi
1414
cd "$script_dir"
1515

1616
dotnet restore ./RabbitMQDotNetClient.sln
17-
dotnet run -p ./projects/Apigen/Apigen.csproj --apiName:AMQP_0_9_1 \
17+
dotnet run --project ./projects/Apigen/Apigen.csproj --apiName:AMQP_0_9_1 \
1818
./projects/specs/amqp0-9-1.stripped.xml \
1919
./gensrc/autogenerated-api-0-9-1.cs
2020
dotnet build ./RabbitMQDotNetClient.sln

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,10 @@ public void Dispose()
2929
ArrayPool<byte>.Shared.Return(_rentedArray);
3030
}
3131
}
32+
33+
public override string ToString()
34+
{
35+
return $"IncomingCommand Method={Method.ProtocolMethodName}, Body.Length={Body.Length}";
36+
}
3237
}
3338
}

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
using System;
3333
using System.Collections;
3434
using System.Collections.Generic;
35+
using System.Runtime.CompilerServices;
3536
using System.Text;
3637

3738
using RabbitMQ.Client.Exceptions;
@@ -72,6 +73,7 @@ internal DecimalData(uint flags, uint hi, uint lo, uint mid)
7273
[MethodImpl(MethodImplOptions.AggressiveInlining)]
7374
public static decimal ReadDecimal(ReadOnlySpan<byte> span)
7475
{
76+
byte scale = span[0];
7577
if (scale > 28)
7678
{
7779
ThrowInvalidDecimalScale(scale);
@@ -120,13 +122,6 @@ public static IList ReadArray(ReadOnlySpan<byte> span, out int bytesRead)
120122
return array;
121123
}
122124

123-
public static decimal ReadDecimal(ReadOnlySpan<byte> span)
124-
{
125-
byte scale = span[0];
126-
uint unsignedMantissa = NetworkOrderDeserializer.ReadUInt32(span.Slice(1));
127-
return AmqpToDecimal(scale, unsignedMantissa);
128-
}
129-
130125
public static object ReadFieldValue(ReadOnlySpan<byte> span, out int bytesRead)
131126
{
132127
bytesRead = 1;

projects/Unit/APIApproval.Approve.verified.txt

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/rabbitmq/rabbitmq-dotnet-client")]
2-
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"Benchmarks, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d20ec856aeeb8c3153a77faa2d80e6e43b5db93224a20cc7ae384f65f142e89730e2ff0fcc5d578bbe96fa98a7196c77329efdee4579b3814c0789e5a39b51df6edd75b602a33ceabdfcf19a3feb832f31d8254168cd7ba5700dfbca301fbf8db614ba41ba18474de0a5f4c2d51c995bc3636c641c8cbe76f45717bfcb943b5")]
1+
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/rabbitmq/rabbitmq-dotnet-client.git")]
32
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"Unit, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d20ec856aeeb8c3153a77faa2d80e6e43b5db93224a20cc7ae384f65f142e89730e2ff0fcc5d578bbe96fa98a7196c77329efdee4579b3814c0789e5a39b51df6edd75b602a33ceabdfcf19a3feb832f31d8254168cd7ba5700dfbca301fbf8db614ba41ba18474de0a5f4c2d51c995bc3636c641c8cbe76f45717bfcb943b5")]
43
namespace RabbitMQ.Client
54
{
@@ -25,16 +24,11 @@ namespace RabbitMQ.Client
2524
public static RabbitMQ.Client.AmqpTcpEndpoint Parse(string address) { }
2625
public static RabbitMQ.Client.AmqpTcpEndpoint[] ParseMultiple(string addresses) { }
2726
}
28-
public struct AmqpTimestamp : System.IEquatable<RabbitMQ.Client.AmqpTimestamp>
27+
public struct AmqpTimestamp
2928
{
3029
public AmqpTimestamp(long unixTime) { }
3130
public long UnixTime { get; }
32-
public bool Equals(RabbitMQ.Client.AmqpTimestamp other) { }
33-
public override bool Equals(object obj) { }
34-
public override int GetHashCode() { }
3531
public override string ToString() { }
36-
public static bool operator !=(RabbitMQ.Client.AmqpTimestamp left, RabbitMQ.Client.AmqpTimestamp right) { }
37-
public static bool operator ==(RabbitMQ.Client.AmqpTimestamp left, RabbitMQ.Client.AmqpTimestamp right) { }
3832
}
3933
public class AsyncDefaultBasicConsumer : RabbitMQ.Client.IAsyncBasicConsumer, RabbitMQ.Client.IBasicConsumer
4034
{
@@ -52,35 +46,28 @@ namespace RabbitMQ.Client
5246
public virtual System.Threading.Tasks.Task HandleModelShutdown(object model, RabbitMQ.Client.ShutdownEventArgs reason) { }
5347
public virtual System.Threading.Tasks.Task OnCancel(params string[] consumerTags) { }
5448
}
55-
public sealed class BasicGetResult : System.IDisposable
49+
public class BasicGetResult
5650
{
5751
public BasicGetResult(ulong deliveryTag, bool redelivered, string exchange, string routingKey, uint messageCount, RabbitMQ.Client.IBasicProperties basicProperties, System.ReadOnlyMemory<byte> body) { }
58-
public BasicGetResult(ulong deliveryTag, bool redelivered, string exchange, string routingKey, uint messageCount, RabbitMQ.Client.IBasicProperties basicProperties, System.ReadOnlyMemory<byte> body, byte[] rentedArray) { }
5952
public RabbitMQ.Client.IBasicProperties BasicProperties { get; }
6053
public System.ReadOnlyMemory<byte> Body { get; }
6154
public ulong DeliveryTag { get; }
6255
public string Exchange { get; }
6356
public uint MessageCount { get; }
6457
public bool Redelivered { get; }
6558
public string RoutingKey { get; }
66-
public void Dispose() { }
59+
}
60+
public static class BasicPublishBatchExtensions
61+
{
62+
public static void Add(this RabbitMQ.Client.IBasicPublishBatch batch, string exchange, string routingKey, bool mandatory, RabbitMQ.Client.IBasicProperties properties, System.ReadOnlyMemory<byte> body) { }
6763
}
6864
public class BinaryTableValue
6965
{
7066
public BinaryTableValue() { }
7167
public BinaryTableValue(byte[] bytes) { }
7268
public byte[] Bytes { get; set; }
7369
}
74-
public sealed class CachedString
75-
{
76-
public readonly System.ReadOnlyMemory<byte> Bytes;
77-
public readonly string Value;
78-
public static readonly RabbitMQ.Client.CachedString Empty;
79-
public CachedString(System.ReadOnlyMemory<byte> bytes) { }
80-
public CachedString(string value) { }
81-
public CachedString(string value, System.ReadOnlyMemory<byte> bytes) { }
82-
}
83-
public sealed class ConnectionFactory : RabbitMQ.Client.ConnectionFactoryBase, RabbitMQ.Client.IConnectionFactory
70+
public sealed class ConnectionFactory : RabbitMQ.Client.ConnectionFactoryBase, RabbitMQ.Client.IAsyncConnectionFactory, RabbitMQ.Client.IConnectionFactory
8471
{
8572
public const ushort DefaultChannelMax = 2047;
8673
public const uint DefaultFrameMax = 0u;
@@ -115,6 +102,7 @@ namespace RabbitMQ.Client
115102
public RabbitMQ.Client.SslOption Ssl { get; set; }
116103
public bool TopologyRecoveryEnabled { get; set; }
117104
public System.Uri Uri { get; set; }
105+
public bool UseBackgroundThreadsForIO { get; set; }
118106
public string UserName { get; set; }
119107
public string VirtualHost { get; set; }
120108
public static System.Net.Sockets.AddressFamily DefaultAddressFamily { get; set; }
@@ -232,6 +220,10 @@ namespace RabbitMQ.Client
232220
System.Threading.Tasks.Task HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, RabbitMQ.Client.IBasicProperties properties, System.ReadOnlyMemory<byte> body);
233221
System.Threading.Tasks.Task HandleModelShutdown(object model, RabbitMQ.Client.ShutdownEventArgs reason);
234222
}
223+
public interface IAsyncConnectionFactory : RabbitMQ.Client.IConnectionFactory
224+
{
225+
bool DispatchConsumersAsync { get; set; }
226+
}
235227
public interface IAuthMechanism
236228
{
237229
byte[] handleChallenge(byte[] challenge, RabbitMQ.Client.IConnectionFactory factory);
@@ -241,6 +233,13 @@ namespace RabbitMQ.Client
241233
string Name { get; }
242234
RabbitMQ.Client.IAuthMechanism GetInstance();
243235
}
236+
public interface IAutorecoveringConnection : RabbitMQ.Client.IConnection, RabbitMQ.Client.INetworkConnection, System.IDisposable
237+
{
238+
event System.EventHandler<RabbitMQ.Client.Events.ConnectionRecoveryErrorEventArgs> ConnectionRecoveryError;
239+
event System.EventHandler<RabbitMQ.Client.Events.ConsumerTagChangedAfterRecoveryEventArgs> ConsumerTagChangeAfterRecovery;
240+
event System.EventHandler<RabbitMQ.Client.Events.QueueNameChangedAfterRecoveryEventArgs> QueueNameChangeAfterRecovery;
241+
event System.EventHandler<System.EventArgs> RecoverySucceeded;
242+
}
244243
public interface IBasicConsumer
245244
{
246245
RabbitMQ.Client.IModel Model { get; }
@@ -300,8 +299,9 @@ namespace RabbitMQ.Client
300299
}
301300
public interface IBasicPublishBatch
302301
{
303-
void Add(RabbitMQ.Client.CachedString exchange, RabbitMQ.Client.CachedString routingKey, bool mandatory, RabbitMQ.Client.IBasicProperties basicProperties, System.ReadOnlyMemory<byte> body);
304-
void Add(string exchange, string routingKey, bool mandatory, RabbitMQ.Client.IBasicProperties properties, System.ReadOnlyMemory<byte> body);
302+
[System.Obsolete("Use Add(string exchange, string routingKey, bool mandatory, IBasicProperties prop" +
303+
"erties, ReadOnlyMemory<byte> body) instead. Will be replaced in version 7.0", false)]
304+
void Add(string exchange, string routingKey, bool mandatory, RabbitMQ.Client.IBasicProperties properties, byte[] body);
305305
void Publish();
306306
}
307307
public interface IConnection : RabbitMQ.Client.INetworkConnection, System.IDisposable
@@ -320,12 +320,8 @@ namespace RabbitMQ.Client
320320
System.Collections.Generic.IList<RabbitMQ.Client.ShutdownReportEntry> ShutdownReport { get; }
321321
event System.EventHandler<RabbitMQ.Client.Events.CallbackExceptionEventArgs> CallbackException;
322322
event System.EventHandler<RabbitMQ.Client.Events.ConnectionBlockedEventArgs> ConnectionBlocked;
323-
event System.EventHandler<RabbitMQ.Client.Events.ConnectionRecoveryErrorEventArgs> ConnectionRecoveryError;
324323
event System.EventHandler<RabbitMQ.Client.ShutdownEventArgs> ConnectionShutdown;
325324
event System.EventHandler<System.EventArgs> ConnectionUnblocked;
326-
event System.EventHandler<RabbitMQ.Client.Events.ConsumerTagChangedAfterRecoveryEventArgs> ConsumerTagChangeAfterRecovery;
327-
event System.EventHandler<RabbitMQ.Client.Events.QueueNameChangedAfterRecoveryEventArgs> QueueNameChangeAfterRecovery;
328-
event System.EventHandler<System.EventArgs> RecoverySucceeded;
329325
void Abort();
330326
void Abort(System.TimeSpan timeout);
331327
void Abort(ushort reasonCode, string reasonText);
@@ -343,15 +339,14 @@ namespace RabbitMQ.Client
343339
{
344340
System.Collections.Generic.IDictionary<string, object> ClientProperties { get; set; }
345341
string ClientProvidedName { get; set; }
346-
int ConsumerDispatchConcurrency { get; set; }
347342
System.TimeSpan ContinuationTimeout { get; set; }
348-
bool DispatchConsumersAsync { get; set; }
349343
System.TimeSpan HandshakeContinuationTimeout { get; set; }
350344
string Password { get; set; }
351345
ushort RequestedChannelMax { get; set; }
352346
uint RequestedFrameMax { get; set; }
353347
System.TimeSpan RequestedHeartbeat { get; set; }
354348
System.Uri Uri { get; set; }
349+
bool UseBackgroundThreadsForIO { get; set; }
355350
string UserName { get; set; }
356351
string VirtualHost { get; set; }
357352
RabbitMQ.Client.IAuthMechanismFactory AuthMechanismFactory(System.Collections.Generic.IList<string> mechanismNames);
@@ -371,6 +366,12 @@ namespace RabbitMQ.Client
371366
{
372367
System.Collections.Generic.IEnumerable<RabbitMQ.Client.AmqpTcpEndpoint> All();
373368
}
369+
public interface IMethod
370+
{
371+
ushort ProtocolClassId { get; }
372+
ushort ProtocolMethodId { get; }
373+
string ProtocolMethodName { get; }
374+
}
374375
public interface IModel : System.IDisposable
375376
{
376377
int ChannelNumber { get; }
@@ -395,7 +396,6 @@ namespace RabbitMQ.Client
395396
string BasicConsume(string queue, bool autoAck, string consumerTag, bool noLocal, bool exclusive, System.Collections.Generic.IDictionary<string, object> arguments, RabbitMQ.Client.IBasicConsumer consumer);
396397
RabbitMQ.Client.BasicGetResult BasicGet(string queue, bool autoAck);
397398
void BasicNack(ulong deliveryTag, bool multiple, bool requeue);
398-
void BasicPublish(RabbitMQ.Client.CachedString exchange, RabbitMQ.Client.CachedString routingKey, bool mandatory, RabbitMQ.Client.IBasicProperties basicProperties, System.ReadOnlyMemory<byte> body);
399399
void BasicPublish(string exchange, string routingKey, bool mandatory, RabbitMQ.Client.IBasicProperties basicProperties, System.ReadOnlyMemory<byte> body);
400400
void BasicQos(uint prefetchSize, ushort prefetchCount, bool global);
401401
void BasicRecover(bool requeue);
@@ -407,7 +407,6 @@ namespace RabbitMQ.Client
407407
uint ConsumerCount(string queue);
408408
RabbitMQ.Client.IBasicProperties CreateBasicProperties();
409409
RabbitMQ.Client.IBasicPublishBatch CreateBasicPublishBatch();
410-
RabbitMQ.Client.IBasicPublishBatch CreateBasicPublishBatch(int sizeHint);
411410
void ExchangeBind(string destination, string source, string routingKey, System.Collections.Generic.IDictionary<string, object> arguments);
412411
void ExchangeBindNoWait(string destination, string source, string routingKey, System.Collections.Generic.IDictionary<string, object> arguments);
413412
void ExchangeDeclare(string exchange, string type, bool durable, bool autoDelete, System.Collections.Generic.IDictionary<string, object> arguments);
@@ -436,14 +435,13 @@ namespace RabbitMQ.Client
436435
void WaitForConfirmsOrDie();
437436
void WaitForConfirmsOrDie(System.TimeSpan timeout);
438437
}
439-
public static class IModelExtensions
438+
public static class IModelExensions
440439
{
441440
public static string BasicConsume(this RabbitMQ.Client.IModel model, string queue, bool autoAck, RabbitMQ.Client.IBasicConsumer consumer) { }
442441
public static string BasicConsume(this RabbitMQ.Client.IModel model, string queue, bool autoAck, string consumerTag, RabbitMQ.Client.IBasicConsumer consumer) { }
443442
public static string BasicConsume(this RabbitMQ.Client.IModel model, string queue, bool autoAck, string consumerTag, System.Collections.Generic.IDictionary<string, object> arguments, RabbitMQ.Client.IBasicConsumer consumer) { }
444443
public static string BasicConsume(this RabbitMQ.Client.IModel model, RabbitMQ.Client.IBasicConsumer consumer, string queue, bool autoAck = false, string consumerTag = "", bool noLocal = false, bool exclusive = false, System.Collections.Generic.IDictionary<string, object> arguments = null) { }
445444
public static void BasicPublish(this RabbitMQ.Client.IModel model, RabbitMQ.Client.PublicationAddress addr, RabbitMQ.Client.IBasicProperties basicProperties, System.ReadOnlyMemory<byte> body) { }
446-
public static void BasicPublish(this RabbitMQ.Client.IModel model, RabbitMQ.Client.CachedString exchange, RabbitMQ.Client.CachedString routingKey, RabbitMQ.Client.IBasicProperties basicProperties, System.ReadOnlyMemory<byte> body) { }
447445
public static void BasicPublish(this RabbitMQ.Client.IModel model, string exchange, string routingKey, RabbitMQ.Client.IBasicProperties basicProperties, System.ReadOnlyMemory<byte> body) { }
448446
public static void BasicPublish(this RabbitMQ.Client.IModel model, string exchange, string routingKey, bool mandatory = false, RabbitMQ.Client.IBasicProperties basicProperties = null, System.ReadOnlyMemory<byte> body = default) { }
449447
public static void ExchangeBind(this RabbitMQ.Client.IModel model, string destination, string source, string routingKey, System.Collections.Generic.IDictionary<string, object> arguments = null) { }
@@ -500,7 +498,6 @@ namespace RabbitMQ.Client
500498
bool Connected { get; }
501499
System.TimeSpan ReceiveTimeout { get; set; }
502500
void Close();
503-
System.Threading.Tasks.Task ConnectAsync(System.Net.IPAddress host, int port);
504501
System.Threading.Tasks.Task ConnectAsync(string host, int port);
505502
System.Net.Sockets.NetworkStream GetStream();
506503
}
@@ -811,10 +808,8 @@ namespace RabbitMQ.Client.Exceptions
811808
[System.Serializable]
812809
public class UnexpectedMethodException : RabbitMQ.Client.Exceptions.ProtocolViolationException
813810
{
814-
public UnexpectedMethodException(ushort classId, ushort methodId, string methodName) { }
815-
public ushort ProtocolClassId { get; }
816-
public ushort ProtocolMethodId { get; }
817-
public string ProtocolMethodName { get; }
811+
public UnexpectedMethodException(RabbitMQ.Client.IMethod method) { }
812+
public RabbitMQ.Client.IMethod Method { get; }
818813
}
819814
public class UnknownClassOrMethodException : RabbitMQ.Client.Exceptions.HardProtocolException
820815
{

0 commit comments

Comments
 (0)