Skip to content

Commit d1aa818

Browse files
committed
Change the warning messages
Just log the message Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
1 parent e830ba6 commit d1aa818

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

RabbitMQ.Stream.Client/Client.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ private async Task HandleIncoming(Memory<byte> frameMemory)
388388
break;
389389
case CreditResponse.Key:
390390
CreditResponse.Read(frame, out var creditResponse);
391-
creditResponse.HandleUnroutableCredit(consumers);
391+
creditResponse.HandleUnRoutableCredit();
392392
break;
393393
default:
394394
HandleCorrelatedCommand(tag, ref frame);

RabbitMQ.Stream.Client/CreditResponse.cs

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,24 @@
44

55
using System;
66
using System.Buffers;
7-
using System.Collections.Generic;
8-
using System.Threading.Tasks;
97

108
namespace RabbitMQ.Stream.Client
119
{
1210
public readonly struct CreditResponse : ICommand
1311
{
1412
public const ushort Key = 9;
15-
private readonly byte subscriptionId;
16-
private readonly ResponseCode responseCode;
1713

1814
private CreditResponse(ResponseCode responseCode, byte subscriptionId)
1915
{
20-
this.subscriptionId = subscriptionId;
21-
this.responseCode = responseCode;
16+
SubscriptionId = subscriptionId;
17+
ResponseCode = responseCode;
2218
}
2319

2420
public int SizeNeeded => throw new NotImplementedException();
2521

26-
public byte SubscriptionId => subscriptionId;
22+
private byte SubscriptionId { get; }
2723

28-
public ResponseCode ResponseCode => responseCode;
24+
private ResponseCode ResponseCode { get; }
2925

3026
public int Write(Span<byte> span)
3127
{
@@ -43,24 +39,17 @@ internal static int Read(ReadOnlySequence<byte> frame, out CreditResponse comman
4339
return offset;
4440
}
4541

46-
internal void HandleUnroutableCredit(IDictionary<byte, Func<Deliver, Task>> consumers)
42+
internal void HandleUnRoutableCredit()
4743
{
48-
/* the server sent a credit-response only in case of
44+
/* the server sends a credit-response only in case of
4945
* problem, e.g. crediting an unknown subscription
5046
* (which can happen when a consumer is closed at
5147
* the same time as the deliverhandler is working
5248
*/
5349

54-
if(consumers.ContainsKey(SubscriptionId) && ResponseCode == ResponseCode.SubscriptionIdDoesNotExist)
55-
{
56-
LogEventSource.Log.LogWarning($"Consumer subscription has been unregistered " +
57-
$"on the server whlie client was publishing credit command(s)");
58-
}
59-
else
60-
{
61-
throw new Exception($"An unexpected {nameof(CreditResponse)} for subscriptionId " +
62-
$"{SubscriptionId} was received with responsecode {ResponseCode}");
63-
}
50+
LogEventSource.Log.LogWarning(
51+
$"Received notification for subscription id: {SubscriptionId} " +
52+
$"code: {ResponseCode}");
6453
}
6554
}
6655
}

RabbitMQ.Stream.Client/PublicAPI.Unshipped.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,7 @@ RabbitMQ.Stream.Client.CreditRequest.SizeNeeded.get -> int
306306
RabbitMQ.Stream.Client.CreditRequest.Write(System.Span<byte> span) -> int
307307
RabbitMQ.Stream.Client.CreditResponse
308308
RabbitMQ.Stream.Client.CreditResponse.CreditResponse() -> void
309-
RabbitMQ.Stream.Client.CreditResponse.ResponseCode.get -> RabbitMQ.Stream.Client.ResponseCode
310309
RabbitMQ.Stream.Client.CreditResponse.SizeNeeded.get -> int
311-
RabbitMQ.Stream.Client.CreditResponse.SubscriptionId.get -> byte
312310
RabbitMQ.Stream.Client.CreditResponse.Write(System.Span<byte> span) -> int
313311
RabbitMQ.Stream.Client.DeclarePublisherRequest
314312
RabbitMQ.Stream.Client.DeclarePublisherRequest.DeclarePublisherRequest() -> void

0 commit comments

Comments
 (0)