Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # ChocolateGateway/ChocolateGateway.csproj # ChocolateOrder.Front/ChocolateOrder.Front.csproj # ChocolateOrder/ChocolateOrder.csproj # ChocolateShipping/ChocolateShipping.csproj # Shared/Shared.csproj
- Loading branch information
1 parent
75cbc04
commit fe89dd5
Showing
13 changed files
with
134 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Shared | ||
{ | ||
using System; | ||
using System.Text; | ||
|
||
public static class DeterministicIdBuilder | ||
{ | ||
public static Guid ToGuid(string src) | ||
{ | ||
byte[] stringbytes = Encoding.UTF8.GetBytes(src); | ||
byte[] hashedBytes = new System.Security.Cryptography | ||
.SHA1CryptoServiceProvider() | ||
.ComputeHash(stringbytes); | ||
Array.Resize(ref hashedBytes, 16); | ||
return new Guid(hashedBytes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using NServiceBus; | ||
using NServiceBus.Pipeline; | ||
|
||
class HackEndpointNameBehavior : IBehavior<IAuditContext, IAuditContext> | ||
{ | ||
public HackEndpointNameBehavior(string endpoint) | ||
{ | ||
this.endpoint = endpoint; | ||
} | ||
|
||
public Task Invoke(IAuditContext context, Func<IAuditContext, Task> next) | ||
{ | ||
context.AddAuditData(Headers.ProcessingEndpoint, endpoint); | ||
|
||
return next(context); | ||
} | ||
|
||
readonly string endpoint; | ||
|
||
internal class Registration : RegisterStep | ||
{ | ||
public Registration(string endpointName) : base((string)"HackEndpointName", typeof(HackEndpointNameBehavior), | ||
(string)"Hacks the endpoint name", b => new HackEndpointNameBehavior(endpointName)) | ||
{ | ||
InsertAfterIfExists("AuditHostInformation"); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Shared/EndpointPartitioning/HackHostInfoHeadersBehavior.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using NServiceBus; | ||
using NServiceBus.Pipeline; | ||
|
||
class HackHostInfoHeadersBehavior : IBehavior<IOutgoingLogicalMessageContext, IOutgoingLogicalMessageContext> | ||
{ | ||
public HackHostInfoHeadersBehavior(string endpoint) | ||
{ | ||
this.endpoint = endpoint; | ||
} | ||
|
||
public Task Invoke(IOutgoingLogicalMessageContext context, Func<IOutgoingLogicalMessageContext, Task> next) | ||
{ | ||
context.Headers[Headers.OriginatingEndpoint] = endpoint; | ||
|
||
return next(context); | ||
} | ||
|
||
readonly string endpoint; | ||
|
||
internal class Registration : RegisterStep | ||
{ | ||
public Registration(string endpointName) : base((string)"HackHostInfoHeaders", typeof(HackHostInfoHeadersBehavior), | ||
(string)"Hacks the endpoint name", b => new HackHostInfoHeadersBehavior(endpointName)) | ||
{ | ||
InsertAfterIfExists("AddHostInfoHeaders"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters