Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade of Rabbit MQ Client #1044

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Wolverine.RabbitMQ.Tests.Bugs;

public class Bug_710_rabbit_exchange_errorneously_used_for_system_queues : RabbitMQContext
public class Bug_710_rabbit_exchange_errorneously_used_for_system_queues
{
[Fact]
public async Task start_system_with_declared_exchange()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public end_to_end_with_conventional_routing_custom_exchange()
{
x.BindToExchange<HeadersMessage>(ExchangeType.Headers, arguments: new Dictionary<string, object>()
{
{"tenant-id", "tenant-id"}
{EnvelopeConstants.TenantIdKey, EnvelopeConstants.TenantIdKey}
});
}
});
Expand Down Expand Up @@ -69,6 +69,7 @@ public async Task send_from_one_node_to_another_all_with_conventional_routing()
var session = await _sender.TrackActivity()
.AlsoTrack(_receiver)
.IncludeExternalTransports()
.WaitForMessageToBeReceivedAt<HeadersMessage>(_receiver)
.Timeout(30.Seconds())
.SendMessageAndWaitAsync(new HeadersMessage(), new DeliveryOptions() {TenantId = "tenant-id"});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ public async Task DisposeAsync()
}
}

[Collection("acceptance")]
public class InlineRabbitMqTransportComplianceTests : TransportCompliance<InlineRabbitMqTransportFixture>;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ public async Task DisposeAsync()
}
}

[Collection("acceptance")]
public class durable_compliance : TransportCompliance<RabbitMqTransportFixture>;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Wolverine.RabbitMQ.Tests;

public class interop_friendly_dead_letter_queue_mechanics: RabbitMQContext, IDisposable
public class interop_friendly_dead_letter_queue_mechanics: IDisposable
{
private readonly string QueueName = Guid.NewGuid().ToString();
private IHost _host;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Wolverine.RabbitMQ.Tests;

public class interoperability_specs : RabbitMQContext, IAsyncLifetime
public class interoperability_specs : IAsyncLifetime
{
private string theQueueName;
private IHost _host;
Expand Down Expand Up @@ -50,7 +50,7 @@ public async Task send_raw_json_to_receiver()
using var channel = await transport.CreateAdminChannelAsync();
var props = new BasicProperties();

await channel.BasicPublishAsync(string.Empty, theQueueName, props, data, true);
await channel.BasicPublishAsync(string.Empty, theQueueName, true, props, data);
});

session.Received.SingleEnvelope<NumberMessage>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Wolverine.RabbitMQ.Tests;

[Collection("rabbitmq")]
public class leader_election : LeadershipElectionCompliance
{
public leader_election(ITestOutputHelper output) : base(output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Wolverine.RabbitMQ.Tests;

public class native_dead_letter_queue_mechanics : RabbitMQContext, IDisposable
public class native_dead_letter_queue_mechanics : IDisposable
{
private readonly string QueueName = Guid.NewGuid().ToString();
private IHost _host;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public async Task DisposeAsync()
}
}

[Collection("acceptance")]
public class PrefixedSendingAndReceivingCompliance : TransportCompliance<PrefixedComplianceFixture>
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public async Task CreateAsync()
_cancellation);

await Channel!.BasicQosAsync(0, Queue.PreFetchCount, false, _cancellation);
await Channel.BasicConsumeAsync(_consumer, Queue.QueueName, false, _transport.ConnectionFactory.ClientProvidedName);
await Channel.BasicConsumeAsync(Queue.QueueName, false, _transport.ConnectionFactory?.ClientProvidedName ?? _runtime.Options.ServiceName, _consumer, _runtime.Cancellation);

if (_transport.AutoPingListeners)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ namespace Wolverine.RabbitMQ.Internal;
internal class RabbitMqSender : RabbitMqChannelAgent, ISender
{
private readonly RabbitMqEndpoint _endpoint;
private readonly string _exchangeName;
private readonly CachedString _exchangeName;
private readonly bool _isDurable;
private readonly string _key;
private readonly IRabbitMqEnvelopeMapper _mapper;
private readonly Func<Envelope, string> _toRoutingKey;
private readonly Func<Envelope, CachedString> _toRoutingKey;

public RabbitMqSender(RabbitMqEndpoint endpoint, RabbitMqTransport transport,
RoutingMode routingType, IWolverineRuntime runtime) : base(
Expand All @@ -24,10 +24,10 @@ public RabbitMqSender(RabbitMqEndpoint endpoint, RabbitMqTransport transport,

_isDurable = endpoint.Mode == EndpointMode.Durable;

_exchangeName = endpoint.ExchangeName;
_exchangeName = new CachedString(endpoint.ExchangeName);
_key = endpoint.RoutingKey();

_toRoutingKey = routingType == RoutingMode.Static ? _ => _key : TopicRouting.DetermineTopicName;
_toRoutingKey = routingType == RoutingMode.Static ? _ => new CachedString(_key) : x => new CachedString(TopicRouting.DetermineTopicName(x));

_mapper = endpoint.BuildMapper(runtime);
_endpoint = endpoint;
Expand Down Expand Up @@ -60,7 +60,7 @@ public async ValueTask SendAsync(Envelope envelope)
_mapper.MapEnvelopeToOutgoing(envelope, props);

var routingKey = _toRoutingKey(envelope);
await Channel.BasicPublishAsync(_exchangeName, routingKey, props, envelope.Data);
await Channel.BasicPublishAsync(_exchangeName, routingKey, false, props, envelope.Data);
}

public override string ToString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ProjectReference Include="..\..\..\Wolverine\Wolverine.csproj"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="RabbitMQ.Client" Version="7.0.0-rc.8" />
<PackageReference Include="RabbitMQ.Client" Version="7.0.0-rc.11" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>

Expand Down
Loading