Skip to content

Commit

Permalink
Merge pull request #62 from rsivanov/master
Browse files Browse the repository at this point in the history
Update rebus to 6.0.0
  • Loading branch information
mookid8000 authored Feb 11, 2020
2 parents b52b057 + cc166d9 commit 9e1c008
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 19 deletions.
10 changes: 8 additions & 2 deletions Rebus.RabbitMq.Tests/RabbitMqTransportFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ public ITransport Create(string inputQueueAddress)

public void CleanUp()
{
_disposables.ForEach(d => d.Dispose());
foreach (var disposable in _disposables)
{
disposable.Dispose();
}
_disposables.Clear();

_queuesToDelete.ForEach(DeleteQueue);
foreach (var queue in _queuesToDelete)
{
DeleteQueue(queue);
}
_queuesToDelete.Clear();
}

Expand Down
13 changes: 8 additions & 5 deletions Rebus.RabbitMq.Tests/Rebus.RabbitMq.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Rebus.RabbitMq\Rebus.RabbitMq.csproj" />
<PackageReference Include="microsoft.net.test.sdk" Version="16.0.1" />
<PackageReference Include="nunit" Version="3.7.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="microsoft.net.test.sdk" Version="16.5.0" />
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="rabbitmq.client" Version="5.1.0" />
<PackageReference Include="rebus" Version="5.1.0" />
<PackageReference Include="rebus.tests.contracts" Version="5.0.0" />
<PackageReference Include="rebus" Version="6.0.0" />
<PackageReference Include="rebus.tests.contracts" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
Expand Down
12 changes: 7 additions & 5 deletions Rebus.RabbitMq/Internals/ConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Linq;
using System.Threading;
using RabbitMQ.Client;
using Rebus.Extensions;
using Rebus.Logging;
using Rebus.RabbitMq;

Expand Down Expand Up @@ -46,8 +45,8 @@ public ConnectionManager(IList<ConnectionEndpoint> endpoints, string inputQueueA
_log.Info("RabbitMQ transport has {count} endpoints available", endpoints.Count);
}

endpoints.ForEach(endpoint =>
{
foreach (var endpoint in endpoints)
{
if (endpoint == null)
{
throw new ArgumentException("Provided endpoint collection should not contain null values");
Expand All @@ -57,7 +56,7 @@ public ConnectionManager(IList<ConnectionEndpoint> endpoints, string inputQueueA
{
throw new ArgumentException("null or empty value is not valid for ConnectionString");
}
});
}

_connectionFactory = new ConnectionFactory
{
Expand Down Expand Up @@ -238,7 +237,10 @@ public void AddClientProperties(Dictionary<string, string> additionalClientPrope

public void SetSslOptions(SslSettings ssl)
{
_amqpTcpEndpoints.ForEach(endpoint => { endpoint.Ssl = ToSslOption(ssl); });
foreach (var endpoint in _amqpTcpEndpoints)
{
endpoint.Ssl = ToSslOption(ssl);
}
}

static SslOption ToSslOption(SslSettings ssl)
Expand Down
12 changes: 6 additions & 6 deletions Rebus.RabbitMq/RabbitMq/RabbitMqTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public async Task Send(string destinationAddress, TransportMessage message, ITra
{
var messages = new ConcurrentQueue<OutgoingMessage>();

context.OnCommitted(() => SendOutgoingMessages(context, messages));
context.OnCommitted((tc) => SendOutgoingMessages(context, messages));

return messages;
});
Expand Down Expand Up @@ -354,7 +354,7 @@ public async Task<TransportMessage> Receive(ITransactionContext context, Cancell
return null;
}

context.OnDisposed(() => _consumers.Enqueue(consumer));
context.OnDisposed((tc) => _consumers.Enqueue(consumer));

if (!consumer.Queue.Dequeue(TwoSeconds, out var result))
{
Expand All @@ -368,13 +368,13 @@ public async Task<TransportMessage> Receive(ITransactionContext context, Cancell

var deliveryTag = result.DeliveryTag;

context.OnCompleted(async () =>
context.OnCompleted(async (tc) =>
{
var model = GetModel(context);
model.BasicAck(deliveryTag, false);
});

context.OnAborted(() =>
context.OnAborted((tc) =>
{
// we might not be able to do this, but it doesn't matter that much if it succeeds
try
Expand Down Expand Up @@ -717,7 +717,7 @@ IModel GetModel(ITransactionContext context)
{
if (modelFromPool.IsOpen)
{
context.OnDisposed(() => _models.Enqueue(modelFromPool));
context.OnDisposed((tc) => _models.Enqueue(modelFromPool));
return modelFromPool;
}

Expand All @@ -734,7 +734,7 @@ IModel GetModel(ITransactionContext context)
var connection = _connectionManager.GetConnection();
var newModel = connection.CreateModel();

context.OnDisposed(() => _models.Enqueue(newModel));
context.OnDisposed((tc) => _models.Enqueue(newModel));

// Configure registered events on model
_callbackOptions?.ConfigureEvents(newModel);
Expand Down
2 changes: 1 addition & 1 deletion Rebus.RabbitMq/Rebus.RabbitMq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<None Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="rebus" Version="5.1.0" />
<PackageReference Include="rebus" Version="6.0.0" />
<PackageReference Include="RabbitMq.Client" Version="5.1.0" />
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
Expand Down

0 comments on commit 9e1c008

Please sign in to comment.