Skip to content

Commit b21e282

Browse files
author
Mikael Nordberg
committed
Merge branch '3.1.1'
2 parents ac97738 + 66f119d commit b21e282

File tree

12 files changed

+89
-91
lines changed

12 files changed

+89
-91
lines changed

Diff for: Samples/ErrorHandling/MyServer.Common/MyServer.Common.csproj

+10-6
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@
3131
<WarningLevel>4</WarningLevel>
3232
</PropertyGroup>
3333
<ItemGroup>
34-
<Reference Include="NServiceBus">
35-
<HintPath>..\..\..\build\output\NServiceBus.dll</HintPath>
34+
<Reference Include="NServiceBus, Version=3.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
35+
<SpecificVersion>False</SpecificVersion>
36+
<HintPath>..\..\..\binaries\NServiceBus.dll</HintPath>
3637
</Reference>
37-
<Reference Include="NServiceBus.Core">
38-
<HintPath>..\..\..\build\output\NServiceBus.Core.dll</HintPath>
38+
<Reference Include="NServiceBus.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
39+
<SpecificVersion>False</SpecificVersion>
40+
<HintPath>..\..\..\binaries\NServiceBus.Core.dll</HintPath>
3941
</Reference>
40-
<Reference Include="NServiceBus.Host">
41-
<HintPath>..\..\..\build\output\host\NServiceBus.Host.exe</HintPath>
42+
<Reference Include="NServiceBus.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
43+
<SpecificVersion>False</SpecificVersion>
44+
<ExecutableExtension>.exe</ExecutableExtension>
45+
<HintPath>..\..\..\binaries\NServiceBus.Host.exe</HintPath>
4246
</Reference>
4347
<Reference Include="System" />
4448
<Reference Include="System.Core" />

Diff for: Samples/ErrorHandling/MyServer.WithSLR/MyServer.WithSLR.csproj

+10-6
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,18 @@
3434
<Reference Include="log4net">
3535
<HintPath>..\..\..\binaries\log4net.dll</HintPath>
3636
</Reference>
37-
<Reference Include="NServiceBus">
38-
<HintPath>..\..\..\build\output\NServiceBus.dll</HintPath>
37+
<Reference Include="NServiceBus, Version=3.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
38+
<SpecificVersion>False</SpecificVersion>
39+
<HintPath>..\..\..\binaries\NServiceBus.dll</HintPath>
3940
</Reference>
40-
<Reference Include="NServiceBus.Core">
41-
<HintPath>..\..\..\build\output\NServiceBus.Core.dll</HintPath>
41+
<Reference Include="NServiceBus.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
42+
<SpecificVersion>False</SpecificVersion>
43+
<HintPath>..\..\..\binaries\NServiceBus.Core.dll</HintPath>
4244
</Reference>
43-
<Reference Include="NServiceBus.Host">
44-
<HintPath>..\..\..\build\output\host\NServiceBus.Host.exe</HintPath>
45+
<Reference Include="NServiceBus.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
46+
<SpecificVersion>False</SpecificVersion>
47+
<ExecutableExtension>.exe</ExecutableExtension>
48+
<HintPath>..\..\..\binaries\NServiceBus.Host.exe</HintPath>
4549
</Reference>
4650
<Reference Include="System" />
4751
<Reference Include="System.Core" />

Diff for: Samples/ErrorHandling/MyServer.WithoutSLR/MyServer.WithoutSLR.csproj

+10-6
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,18 @@
3434
<Reference Include="log4net">
3535
<HintPath>..\..\..\binaries\log4net.dll</HintPath>
3636
</Reference>
37-
<Reference Include="NServiceBus">
38-
<HintPath>..\..\..\build\output\NServiceBus.dll</HintPath>
37+
<Reference Include="NServiceBus, Version=3.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
38+
<SpecificVersion>False</SpecificVersion>
39+
<HintPath>..\..\..\binaries\NServiceBus.dll</HintPath>
3940
</Reference>
40-
<Reference Include="NServiceBus.Core">
41-
<HintPath>..\..\..\build\output\NServiceBus.Core.dll</HintPath>
41+
<Reference Include="NServiceBus.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
42+
<SpecificVersion>False</SpecificVersion>
43+
<HintPath>..\..\..\binaries\NServiceBus.Core.dll</HintPath>
4244
</Reference>
43-
<Reference Include="NServiceBus.Host">
44-
<HintPath>..\..\..\build\output\host\NServiceBus.Host.exe</HintPath>
45+
<Reference Include="NServiceBus.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
46+
<SpecificVersion>False</SpecificVersion>
47+
<ExecutableExtension>.exe</ExecutableExtension>
48+
<HintPath>..\..\..\binaries\NServiceBus.Host.exe</HintPath>
4549
</Reference>
4650
<Reference Include="System" />
4751
<Reference Include="System.Core" />

Diff for: Samples/Starbucks/Customer/Customer.csproj

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@
3737
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3838
</PropertyGroup>
3939
<ItemGroup>
40-
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
41-
<SpecificVersion>False</SpecificVersion>
42-
<HintPath>..\..\..\lib\log4net.dll</HintPath>
40+
<Reference Include="log4net">
41+
<HintPath>..\..\..\binaries\log4net.dll</HintPath>
4342
</Reference>
4443
<Reference Include="NServiceBus, Version=2.1.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
4544
<SpecificVersion>False</SpecificVersion>

Diff for: Samples/WcfIntegration/WcfIntegration.suo

1.5 KB
Binary file not shown.

Diff for: default.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ task PrepareRelease -depends GenerateAssemblyInfo, PrepareBinaries, CompileSampl
570570
Copy-Item -Force -Recurse "$baseDir\Samples" $releaseRoot\samples -ErrorAction SilentlyContinue
571571
cd $releaseRoot\samples
572572

573-
dir -recurse -include ('bin', 'obj') |ForEach-Object {
573+
dir -recurse -include ('bin', 'obj', 'packages') |ForEach-Object {
574574
write-host deleting $_
575575
Delete-Directory $_
576576
}

Diff for: src/impl/faults/NServiceBus.Faults.Forwarder/FaultManager.cs

+20-28
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,19 @@ void SendFailureMessage(TransportMessage message, Exception e, string reason)
3838
SetExceptionHeaders(message, e, reason);
3939
try
4040
{
41-
Send(message, ErrorQueue, reason);
41+
var destinationQ = RetriesErrorQueue ?? ErrorQueue;
42+
43+
// Intentionally service-locate ISendMessages to avoid circular
44+
// resolution problem in the container
45+
var sender = Configure.Instance.Builder.Build<ISendMessages>();
46+
47+
if (MessageWasSentFromSLR(message) || reason == "SerializationFailed")
48+
{
49+
sender.Send(message, ErrorQueue);
50+
return;
51+
}
52+
53+
sender.Send(message, destinationQ);
4254
}
4355
catch (Exception exception)
4456
{
@@ -54,38 +66,16 @@ void SendFailureMessage(TransportMessage message, Exception e, string reason)
5466

5567
}
5668

57-
// Intentionally service-locate ISendMessages to avoid circular
58-
// resolution problem in the container
59-
protected virtual void Send(TransportMessage message, Address errorQueue, string reason)
60-
{
61-
var sender = Configure.Instance.Builder.Build<ISendMessages>();
62-
63-
if (MessageWasSentFromSLR(message) || reason == "SerializationFailed")
64-
{
65-
sender.Send(message, RealErrorQueue);
66-
return;
67-
}
68-
69-
sender.Send(message, ErrorQueue);
70-
}
71-
7269
bool MessageWasSentFromSLR(TransportMessage message)
7370
{
74-
if (RealErrorQueue == null)
71+
if (RetriesErrorQueue == null)
7572
{
7673
return false;
7774
}
7875

7976
// if the reply to address == ErrorQueue and RealErrorQueue is not null, the
80-
// SecondLevelRetries sat is running and the error happend within that sat.
81-
var replyToAddress = TransportMessageHelpers.GetReplyToAddress(message);
82-
83-
if (replyToAddress == ErrorQueue)
84-
{
85-
return true;
86-
}
87-
88-
return false;
77+
// SecondLevelRetries sat is running and the error happend within that sat.
78+
return TransportMessageHelpers.GetReplyToAddress(message) == RetriesErrorQueue;
8979
}
9080

9181
void SetExceptionHeaders(TransportMessage message, Exception e, string reason)
@@ -115,8 +105,10 @@ void SetExceptionHeaders(TransportMessage message, Exception e, string reason)
115105
/// </summary>
116106
public Address ErrorQueue { get; set; }
117107

118-
119-
public Address RealErrorQueue { get; set; }
108+
/// <summary>
109+
/// The address of the Second Level Retries input queue when SLR is enabled
110+
/// </summary>
111+
public Address RetriesErrorQueue { get; set; }
120112

121113
/// <summary>
122114
/// Indicates of exceptions should be sanitized before sending them on

Diff for: src/management/retries/NServiceBus.Management.Retries.Tests/SecondLevelRetriesTests.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using NServiceBus.Faults.Forwarder;
34
using NServiceBus.Management.Retries.Helpers;
45
using NServiceBus.Unicast.Queuing;
56
using NServiceBus.Unicast.Transport;
@@ -22,7 +23,7 @@ public class SecondLevelRetriesTests
2223
public void SetUp()
2324
{
2425
_satellite.InputAddress = RETRIES_QUEUE;
25-
_satellite.ErrorQueue = ERROR_QUEUE;
26+
_satellite.FaultManager = new FaultManager {ErrorQueue = ERROR_QUEUE};
2627
_satellite.TimeoutManagerAddress = TIMEOUT_MANAGER_QUEUE;
2728

2829
_satellite.MessageSender = _messageSender;

Diff for: src/management/retries/NServiceBus.Management.Retries/Config/SecondLevelRetriesConfiguration.cs

+24-36
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,38 @@
77

88
namespace NServiceBus.Config
99
{
10-
public class SecondLevelRetriesConfiguration : INeedInitialization, INeedToInstallSomething<Installation.Environments.Windows>
10+
public class SecondLevelRetriesConfiguration : IWantToRunBeforeConfigurationIsFinalized, INeedToInstallSomething<Installation.Environments.Windows>
1111
{
12-
public void Init()
12+
private static bool isEnabled;
13+
14+
public void Run()
1315
{
1416
var retriesConfig = Configure.GetConfigSection<SecondLevelRetriesConfig>();
1517
var enabled = retriesConfig != null ? retriesConfig.Enabled : true;
16-
17-
Address errorQueue = null;
18-
19-
if (enabled)
18+
19+
if (!Configure.Instance.Configurer.HasComponent<FaultManager>() || !enabled)
2020
{
21-
var forwardingInCaseOfFaultConfig = Configure.GetConfigSection<MessageForwardingInCaseOfFaultConfig>();
21+
Configure.Instance.Configurer.ConfigureComponent<SecondLevelRetries>(DependencyLifecycle.SingleInstance)
22+
.ConfigureProperty(rs => rs.Disabled, true);
2223

23-
if (forwardingInCaseOfFaultConfig != null)
24-
{
25-
errorQueue = Address.Parse(forwardingInCaseOfFaultConfig.ErrorQueue);
26-
}
24+
return;
2725
}
28-
29-
if (errorQueue != null)
26+
27+
if (retriesConfig != null)
3028
{
31-
if (retriesConfig != null)
32-
{
33-
SetUpRetryPolicy(retriesConfig);
34-
}
29+
SetUpRetryPolicy(retriesConfig);
30+
}
3531

36-
var retriesErrorQ = GetAddress();
37-
var originalErrorQueue = errorQueue;
32+
var retriesErrorQ = GetAddress();
3833

39-
// and only when the retries satellite is running should we alter the FaultManager
40-
Configure.Instance.Configurer.ConfigureProperty<FaultManager>(fm => fm.ErrorQueue, retriesErrorQ);
41-
Configure.Instance.Configurer.ConfigureProperty<FaultManager>(fm => fm.RealErrorQueue, originalErrorQueue);
34+
// and only when the retries satellite is running should we alter the FaultManager
35+
Configure.Instance.Configurer.ConfigureProperty<FaultManager>(fm => fm.RetriesErrorQueue, retriesErrorQ);
4236

43-
Configure.Instance.Configurer.ConfigureComponent<SecondLevelRetries>(DependencyLifecycle.SingleInstance)
44-
.ConfigureProperty(rs => rs.ErrorQueue, originalErrorQueue)
45-
.ConfigureProperty(rs => rs.InputAddress, retriesErrorQ)
46-
.ConfigureProperty(rs => rs.TimeoutManagerAddress, Configure.Instance.GetTimeoutManagerAddress());
37+
Configure.Instance.Configurer.ConfigureComponent<SecondLevelRetries>(DependencyLifecycle.SingleInstance)
38+
.ConfigureProperty(rs => rs.InputAddress, retriesErrorQ)
39+
.ConfigureProperty(rs => rs.TimeoutManagerAddress, Configure.Instance.GetTimeoutManagerAddress());
4740

48-
49-
}
50-
else
51-
{
52-
Configure.Instance.Configurer.ConfigureComponent<SecondLevelRetries>(DependencyLifecycle.SingleInstance)
53-
.ConfigureProperty(rs => rs.Disabled, true);
54-
55-
Configure.Instance.Configurer.ConfigureProperty<FaultManager>(fm => fm.RealErrorQueue, null);
56-
}
41+
isEnabled = true;
5742
}
5843

5944
static void SetUpRetryPolicy(SecondLevelRetriesConfig retriesConfig)
@@ -71,11 +56,14 @@ static void SetUpRetryPolicy(SecondLevelRetriesConfig retriesConfig)
7156

7257
public void Install(WindowsIdentity identity)
7358
{
59+
if (!isEnabled)
60+
return;
61+
7462
MsmqUtilities.CreateQueueIfNecessary(GetAddress(), WindowsIdentity.GetCurrent().Name);
7563
}
7664

7765
static Address GetAddress()
78-
{
66+
{
7967
return Address.Parse(Configure.EndpointName).SubScope("Retries");
8068
}
8169
}

Diff for: src/management/retries/NServiceBus.Management.Retries/NServiceBus.Management.Retries.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
<Reference Include="NServiceBus.Unicast.Transport">
8080
<HintPath>..\..\..\..\build\nservicebus.core\NServiceBus.Unicast.Transport.dll</HintPath>
8181
</Reference>
82+
<Reference Include="NServiceBus.Unicast.Transport.Msmq.Config, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
83+
<SpecificVersion>False</SpecificVersion>
84+
<HintPath>..\..\..\..\build\nservicebus.core\NServiceBus.Unicast.Transport.Msmq.Config.dll</HintPath>
85+
</Reference>
8286
<Reference Include="NServiceBus.Unicast.Transport.Transactional">
8387
<HintPath>..\..\..\..\build\nservicebus.core\NServiceBus.Unicast.Transport.Transactional.dll</HintPath>
8488
</Reference>

Diff for: src/management/retries/NServiceBus.Management.Retries/SecondLevelRetries.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using log4net;
3+
using NServiceBus.Faults.Forwarder;
34
using NServiceBus.Management.Retries.Helpers;
45
using NServiceBus.Satellites;
56
using NServiceBus.Unicast.Queuing;
@@ -12,11 +13,13 @@ public class SecondLevelRetries : ISatellite
1213
ILog Logger = LogManager.GetLogger("SecondLevelRetries");
1314

1415
public ISendMessages MessageSender { get; set; }
15-
public Address ErrorQueue { get; set; }
16+
1617
public Address InputAddress { get; set; }
1718
public Address TimeoutManagerAddress { get; set; }
1819
public bool Disabled { get; set; }
1920

21+
public FaultManager FaultManager { get; set; }
22+
2023
public static Func<TransportMessage, TimeSpan> RetryPolicy = DefaultRetryPolicy.Validate;
2124
public static Func<TransportMessage, bool> TimeoutPolicy = DefaultRetryPolicy.HasTimedOut;
2225

@@ -51,10 +54,10 @@ public void Handle(TransportMessage message)
5154

5255
void SendToErrorQueue(TransportMessage message)
5356
{
54-
Logger.InfoFormat("Send message to error queue, {0}", ErrorQueue);
57+
Logger.InfoFormat("Send message to error queue, {0}", FaultManager.ErrorQueue);
5558

5659
message.ReplyToAddress = TransportMessageHelpers.GetReplyToAddress(message);
57-
MessageSender.Send(message, ErrorQueue);
60+
MessageSender.Send(message, FaultManager.ErrorQueue);
5861
}
5962

6063
void Defer(TimeSpan defer, TransportMessage message)

Diff for: src/satellites/NServiceBus.Satellites/SatelliteLauncher.cs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public void Run()
2727
timer.Elapsed += (o, e) => Start();
2828

2929
Build();
30-
3130
Initialize();
3231
Start();
3332
}

0 commit comments

Comments
 (0)