Skip to content

Commit 38a43b8

Browse files
committed
Merge branch 'hotfix-2.0.4'
2 parents d2548e8 + 8d67ad6 commit 38a43b8

File tree

13 files changed

+171
-64
lines changed

13 files changed

+171
-64
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
nugets
2+
deploy
23
build32
34
binaries
45
obj

Octopus/DeploymentProcess.json

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"Steps": [
3+
{
4+
"Id": "b3339d4f-563f-49ac-b759-554619554f9d",
5+
"Name": "Deploy",
6+
"RequiresPackagesToBeAcquired": false,
7+
"Properties": {
8+
"Octopus.Action.TargetRoles": "tentacle"
9+
},
10+
"Condition": "Success",
11+
"Actions": [
12+
{
13+
"Id": "f57466ee-18c3-4f89-9aa9-153814528a44",
14+
"Name": "Deploy",
15+
"ActionType": "Octopus.TentaclePackage",
16+
"Environments": [],
17+
"Properties": {
18+
"Octopus.Action.Package.NuGetFeedId": "feeds-1",
19+
"Octopus.Action.EnabledFeatures": "Octopus.Features.ConfigurationTransforms,Octopus.Features.ConfigurationVariables",
20+
"Octopus.Action.Package.AutomaticallyRunConfigurationTransformationFiles": "False",
21+
"Octopus.Action.Package.AutomaticallyUpdateAppSettingsAndConnectionStrings": "False",
22+
"Octopus.Action.Package.DownloadOnTentacle": "False",
23+
"Octopus.Action.Package.NuGetPackageId": "%PROJECT_NAME%.Deploy"
24+
},
25+
"SensitiveProperties": {}
26+
}
27+
],
28+
"SensitiveProperties": {}
29+
},
30+
{
31+
"Id": "674e1a63-42cf-440e-83be-f80f58ef85a1",
32+
"Name": "Notify of draft",
33+
"RequiresPackagesToBeAcquired": false,
34+
"Properties": {
35+
"Octopus.Action.TargetRoles": "tentacle"
36+
},
37+
"Condition": "Success",
38+
"Actions": [
39+
{
40+
"Id": "578efb8c-8303-4c1f-88a9-f3cee9e14e0a",
41+
"Name": "Notify of draft",
42+
"ActionType": "Octopus.Script",
43+
"Environments": [
44+
"Environments-65"
45+
],
46+
"Properties": {
47+
"Octopus.Action.Script.ScriptBody": "$message = if ($OctopusParameters['HipChatMessage']) { $OctopusParameters['HipChatMessage'] } else { \"(successful) %PROJECT_NAME% [v$($OctopusParameters['Octopus.Release.Number'])] deployed to $($OctopusParameters['Octopus.Environment.Name']) on $($OctopusParameters['Octopus.Machine.Name'])\" } \n#---------\n$apitoken = $OctopusParameters['HipChatAuthToken']\n$roomid = $OctopusParameters['HipChatRoomId']\n$from = $OctopusParameters['HipChatFrom']\n$colour = $OctopusParameters['HipChatColor']\n\nTry \n{\n\t#Do the HTTP POST to HipChat\n\t$post = \"auth_token=$apitoken&room_id=$roomid&from=$from&color=$colour&message=$message&notify=1&message_format=text\"\n\t$webRequest = [System.Net.WebRequest]::Create(\"https://api.hipchat.com/v1/rooms/message\")\n\t$webRequest.ContentType = \"application/x-www-form-urlencoded\"\n\t$postStr = [System.Text.Encoding]::UTF8.GetBytes($post)\n\t$webrequest.ContentLength = $postStr.Length\n\t$webRequest.Method = \"POST\"\n\t$requestStream = $webRequest.GetRequestStream()\n\t$requestStream.Write($postStr, 0,$postStr.length)\n\t$requestStream.Close()\n\t\n\t[System.Net.WebResponse] $resp = $webRequest.GetResponse();\n\t$rs = $resp.GetResponseStream();\n\t[System.IO.StreamReader] $sr = New-Object System.IO.StreamReader -argumentList $rs;\n\t$sr.ReadToEnd();\t\t\t\t\t\n}\ncatch [Exception] {\n\t\"Woah!, wasn't expecting to get this exception. `r`n $_.Exception.ToString()\"\n}",
48+
"Octopus.Action.Template.Id": "ActionTemplates-2",
49+
"Octopus.Action.Template.Version": "0",
50+
"HipChatFrom": "Octopus Deploy",
51+
"HipChatColor": "green",
52+
"HipChatRoomId": "#{HipChatEngineeringID}",
53+
"HipChatAuthToken": "#{HipChatAPIV1}",
54+
"HipChatMessage": "New draft release of %PROJECT_NAME% at https://github.com/Particular/%PROJECT_NAME%/releases"
55+
},
56+
"SensitiveProperties": {}
57+
}
58+
],
59+
"SensitiveProperties": {}
60+
},
61+
{
62+
"Id": "b6145394-b751-4d2e-8a92-1b82f1a3fc9a",
63+
"Name": "Verify draft",
64+
"RequiresPackagesToBeAcquired": false,
65+
"Properties": {
66+
"Octopus.Action.TargetRoles": ""
67+
},
68+
"Condition": "Success",
69+
"Actions": [
70+
{
71+
"Id": "737fa883-457b-4821-805a-ade60e58e181",
72+
"Name": "Verify draft",
73+
"ActionType": "Octopus.Manual",
74+
"Environments": [
75+
"Environments-65"
76+
],
77+
"Properties": {
78+
"Octopus.Action.Manual.ResponsibleTeamIds": "teams-everyone",
79+
"Octopus.Action.Manual.Instructions": "Please verify the draft release notes of %PROJECT_NAME% at https://github.com/Particular/%PROJECT_NAME%/releases"
80+
},
81+
"SensitiveProperties": {}
82+
}
83+
],
84+
"SensitiveProperties": {}
85+
}
86+
],
87+
"Version" : "%VERSION%"
88+
}

Octopus/Project.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"IncludedLibraryVariableSetIds": [
3+
"LibraryVariableSets-33",
4+
"LibraryVariableSets-36",
5+
"LibraryVariableSets-35",
6+
"LibraryVariableSets-65",
7+
"LibraryVariableSets-67"
8+
],
9+
"DefaultToSkipIfAlreadyInstalled": false,
10+
"VersioningStrategy": {
11+
"DonorPackageStepId": null,
12+
"Template": "#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.NextPatch}"
13+
},
14+
"Name": "%OCTO_PROJECT_NAME%",
15+
"Description": "",
16+
"IsDisabled": false,
17+
"ProjectGroupId": "ProjectGroups-99",
18+
}

packaging/nuget/NServiceBus.Transports.RabbitMQ.nuspec renamed to packaging/nuget/NServiceBus.RabbitMQ.nuspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
</metadata>
2222
<files>
2323
<file src="..\..\binaries\NServiceBus.Transports.RabbitMQ.???" target="lib\net45" />
24-
<file src="tools\**" target="tools" />
2524
<file src="..\..\src\NServiceBus.RabbitMQ\**\*.cs" exclude="..\..\src\NServiceBus.RabbitMQ\**\TemporaryGeneratedFile_*.cs" target="src" />
2625
</files>
2726
</package>

packaging/nuget/tools/install.ps1

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

src/.nuget/packages.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="NuGet.CommandLine" version="2.8.2" />
3+
<package id="ConsoleTweet" version="0.1.0" />
4+
<package id="GitHubReleaseNotes" version="0.1.1" />
5+
<package id="NuGet.CommandLine" version="2.8.3" />
46
</packages>

src/NServiceBus.RabbitMQ.sln.DotSettings

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@
125125
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ValueParameterNotUsed/@EntryIndexedValue">ERROR</s:String>
126126
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VBPossibleMistakenCallToGetType_002E1/@EntryIndexedValue">ERROR</s:String>
127127
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VBPossibleMistakenCallToGetType_002E2/@EntryIndexedValue">ERROR</s:String>
128+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=Xaml_002ERedundantCollectionProperty/@EntryIndexedValue">ERROR</s:String>
129+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=Xaml_002ERedundantModifiersAttribute/@EntryIndexedValue">ERROR</s:String>
130+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=Xaml_002ERedundantNamespaceAlias/@EntryIndexedValue">ERROR</s:String>
131+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=Xaml_002ERedundantPropertyTypeQualifier/@EntryIndexedValue">ERROR</s:String>
132+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=Xaml_002ERedundantResource/@EntryIndexedValue">ERROR</s:String>
133+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=Xaml_002ERedundantStyledValue/@EntryIndexedValue">ERROR</s:String>
134+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=Xaml_002EStaticResourceNotResolved/@EntryIndexedValue">ERROR</s:String>
128135
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Format_0020My_0020Code_0020Using_0020_0022Particular_0022_0020conventions/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Format My Code Using &amp;quot;Particular&amp;quot; conventions"&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;CAN_CHANGE_TO_IMPLICIT&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;ALWAYS_IMPLICIT&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_IMPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSReorderTypeMembers&gt;True&lt;/CSReorderTypeMembers&gt;&lt;JsInsertSemicolon&gt;True&lt;/JsInsertSemicolon&gt;&lt;JsReformatCode&gt;True&lt;/JsReformatCode&gt;&lt;CssReformatCode&gt;True&lt;/CssReformatCode&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;RemoveCodeRedundancies&gt;True&lt;/RemoveCodeRedundancies&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;HtmlReformatCode&gt;True&lt;/HtmlReformatCode&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;CssAlphabetizeProperties&gt;True&lt;/CssAlphabetizeProperties&gt;&lt;/Profile&gt;</s:String>
129136
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Default: Reformat Code</s:String>
130137
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Format My Code Using "Particular" conventions</s:String>

src/NServiceBus.RabbitMQ/ConfirmsAwareChannel.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,29 @@ public void Dispose()
3030
{
3131
if (usePublisherConfirms)
3232
{
33-
Channel.WaitForConfirmsOrDie(maxWaitTimeForConfirms);
34-
}
33+
try
34+
{
35+
Channel.WaitForConfirmsOrDie(maxWaitTimeForConfirms);
36+
}
37+
catch (AlreadyClosedException ex)
38+
{
39+
if (ex.ShutdownReason != null && ex.ShutdownReason.ReplyCode == 404)
40+
{
41+
var msg = ex.ShutdownReason.ReplyText;
42+
var matches = Regex.Matches(msg, @"'([^' ]*)'");
43+
var exchangeName = matches.Count > 0 && matches[0].Groups.Count > 1 ? Address.Parse(matches[0].Groups[1].Value) : null;
44+
throw new QueueNotFoundException(exchangeName, "Exchange for the recipient does not exist", ex);
45+
}
3546

36-
Channel.Dispose();
47+
throw;
48+
}
49+
}
3750
}
38-
catch (AlreadyClosedException ex)
51+
finally
3952
{
40-
if (ex.ShutdownReason != null && ex.ShutdownReason.ReplyCode == 404)
41-
{
42-
var msg = ex.ShutdownReason.ReplyText;
43-
var matches = Regex.Matches(msg, @"'([^' ]*)'");
44-
var exchangeName = matches.Count > 0 && matches[0].Groups.Count > 1 ? Address.Parse(matches[0].Groups[1].Value) : null;
45-
throw new QueueNotFoundException(exchangeName, "Exchange for the recipient does not exist", ex);
46-
}
47-
48-
throw;
53+
// After decompiling it looks like Abort is a safest method to call instead of Close/Dispose
54+
// Close/Dispose throws exceptions if the channel is already closed!
55+
Channel.Abort();
4956
}
5057
}
5158

src/NServiceBus.RabbitMQ/NServiceBus.RabbitMQ.csproj

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@
5252
<Private>False</Private>
5353
</Reference>
5454
<Reference Include="Microsoft.CSharp" />
55-
<Reference Include="NServiceBus.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
56-
<SpecificVersion>False</SpecificVersion>
57-
<HintPath>..\packages\NServiceBus.5.0.0\lib\net45\NServiceBus.Core.dll</HintPath>
55+
<Reference Include="NServiceBus.Core">
56+
<HintPath>..\packages\NServiceBus.5.0.2\lib\net45\NServiceBus.Core.dll</HintPath>
5857
</Reference>
5958
<Reference Include="Obsolete">
6059
<HintPath>..\packages\Obsolete.Fody.3.1.0.0\Lib\NET35\Obsolete.dll</HintPath>
@@ -124,11 +123,11 @@
124123
<PropertyGroup>
125124
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
126125
</PropertyGroup>
127-
<Error Condition="!Exists('..\packages\Fody.1.25.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.25.0\build\Fody.targets'))" />
128-
<Error Condition="!Exists('..\packages\NuGetPackager.0.1.6\build\NuGetPackager.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NuGetPackager.0.1.6\build\NuGetPackager.targets'))" />
129-
<Error Condition="!Exists('..\packages\GitVersionTask.1.3.0\Build\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.1.3.0\Build\GitVersionTask.targets'))" />
126+
<Error Condition="!Exists('..\packages\Fody.1.26.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.26.0\build\Fody.targets'))" />
127+
<Error Condition="!Exists('..\packages\GitVersionTask.1.3.2\Build\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.1.3.2\Build\GitVersionTask.targets'))" />
128+
<Error Condition="!Exists('..\packages\NuGetPackager.0.4.12\build\NuGetPackager.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NuGetPackager.0.4.12\build\NuGetPackager.targets'))" />
130129
</Target>
131-
<Import Project="..\packages\Fody.1.25.0\build\Fody.targets" Condition="Exists('..\packages\Fody.1.25.0\build\Fody.targets')" />
132-
<Import Project="..\packages\NuGetPackager.0.1.6\build\NuGetPackager.targets" Condition="Exists('..\packages\NuGetPackager.0.1.6\build\NuGetPackager.targets')" />
133-
<Import Project="..\packages\GitVersionTask.1.3.0\Build\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.1.3.0\Build\GitVersionTask.targets')" />
130+
<Import Project="..\packages\Fody.1.26.0\build\Fody.targets" Condition="Exists('..\packages\Fody.1.26.0\build\Fody.targets')" />
131+
<Import Project="..\packages\GitVersionTask.1.3.2\Build\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.1.3.2\Build\GitVersionTask.targets')" />
132+
<Import Project="..\packages\NuGetPackager.0.4.12\build\NuGetPackager.targets" Condition="Exists('..\packages\NuGetPackager.0.4.12\build\NuGetPackager.targets')" />
134133
</Project>

src/NServiceBus.RabbitMQ/RabbitMqDequeueStrategy.cs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ public void Start(int maximumConcurrencyLevel)
6969
{
7070
var secondaryReceiveSettings = secondaryReceiveConfiguration.GetSettings(workQueue);
7171

72-
var actualConcurrencyLevel = maximumConcurrencyLevel + secondaryReceiveSettings.MaximumConcurrencyLevel;
72+
actualConcurrencyLevel = maximumConcurrencyLevel + secondaryReceiveSettings.MaximumConcurrencyLevel;
7373

7474
tokenSource = new CancellationTokenSource();
7575

7676
// We need to add an extra one because if we fail and the count is at zero already, it doesn't allow us to add one more.
77-
countdownEvent = new CountdownEvent(actualConcurrencyLevel + 1);
77+
tracksRunningThreads = new SemaphoreSlim(actualConcurrencyLevel, actualConcurrencyLevel);
7878

7979
for (var i = 0; i < maximumConcurrencyLevel; i++)
8080
{
@@ -104,8 +104,19 @@ public void Stop()
104104
}
105105

106106
tokenSource.Cancel();
107-
countdownEvent.Signal();
108-
countdownEvent.Wait();
107+
DrainStopSemaphore();
108+
}
109+
110+
void DrainStopSemaphore()
111+
{
112+
for (var index = 0; index < actualConcurrencyLevel; index++)
113+
{
114+
tracksRunningThreads.Wait();
115+
}
116+
117+
tracksRunningThreads.Release(actualConcurrencyLevel);
118+
119+
tracksRunningThreads.Dispose();
109120
}
110121

111122
public void Dispose()
@@ -128,10 +139,7 @@ void StartConsumer(string queue)
128139

129140
if (!tokenSource.IsCancellationRequested)
130141
{
131-
if (countdownEvent.TryAddCount())
132-
{
133-
StartConsumer(queue);
134-
}
142+
StartConsumer(queue);
135143
}
136144
}, TaskContinuationOptions.OnlyOnFaulted);
137145
}
@@ -140,6 +148,8 @@ void ConsumeMessages(object state)
140148
{
141149
try
142150
{
151+
tracksRunningThreads.Wait();
152+
143153
var parameters = (ConsumeParams)state;
144154
var connection = connectionManager.GetConsumeConnection();
145155

@@ -221,7 +231,7 @@ void ConsumeMessages(object state)
221231
}
222232
finally
223233
{
224-
countdownEvent.Signal();
234+
tracksRunningThreads.Release();
225235
}
226236
}
227237

@@ -264,12 +274,13 @@ void Purge()
264274
RepeatedFailuresOverTimeCircuitBreaker circuitBreaker;
265275

266276
bool autoAck;
267-
CountdownEvent countdownEvent;
277+
SemaphoreSlim tracksRunningThreads;
268278
Action<TransportMessage, Exception> endProcessMessage;
269279
CancellationTokenSource tokenSource;
270280
Func<TransportMessage, bool> tryProcessMessage;
271281
string workQueue;
272282
bool purgeOnStartup;
283+
int actualConcurrencyLevel;
273284

274285

275286
class ConsumeParams

0 commit comments

Comments
 (0)