This file contains hidden or 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
| using System; | |
| using System.Security.Cryptography; | |
| using System.Threading.Tasks; | |
| using NServiceBus.MessageMutator; | |
| /// <summary> | |
| /// endpointConfiguration.RegisterMessageMutator(new VerifyBodyMessageMutator()); | |
| /// </summary> | |
| public class VerifyBodyMessageMutator : IMutateIncomingTransportMessages, IMutateOutgoingTransportMessages | |
| { |
This file contains hidden or 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
| class DoThatWhenXHappened | |
| : IHandleMessages<XHappened> | |
| , IHandleMessages<DoThat> | |
| { | |
| async Task Handle(XHappened msg, IMessageHandlerContext ctx) | |
| { | |
| await ctx.SendLocal(new DoThat()); | |
| } | |
| async Task Handle(DoThat msg, IMessageHandlerContext ctx) |
This file contains hidden or 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
| // Source: https://github.com/LogosBible/Logos.Utility/blob/master/src/Logos.Utility/GuidUtility.cs | |
| using System; | |
| using System.Security.Cryptography; | |
| using System.Text; | |
| /// <summary> | |
| /// Helper methods for working with <see cref="Guid"/>. | |
| /// </summary> | |
| static class GuidUtility | |
| { |
This file contains hidden or 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
| // | |
| // var pipeline = endpointConfiguration.Pipeline; | |
| // pipeline.Register(behavior: new AddMessageContextIdentifierstoExceptionBehavior(), description: "Assigns the incoming message context identifiers to the exception for diagnostical purposes."); | |
| // | |
| class AddMessageContextIdentifierstoExceptionBehavior : Behavior<ITransportReceiveContext> | |
| { | |
| public override async Task Invoke(ITransportReceiveContext context, Func<Task> next) | |
| { | |
| try | |
| { |
This file contains hidden or 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
| using System.IO; | |
| using System.Threading.Tasks; | |
| namespace System.Security.Cryptography | |
| { | |
| public static class HashAlgorithmExt | |
| { | |
| public static async Task<byte[]> ComputeHashAsync(this HashAlgorithm algorithm, Stream stream, int blockSize = 0x14000) | |
| { | |
| var buffer = new byte[blockSize]; |
This file contains hidden or 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
| // Usage: endpointConfiguration.Conventions().Apply(); | |
| [AttributeUsage(AttributeTargets.Class|AttributeTargets.Interface)] | |
| public class MessageAttribute : Attribute | |
| { | |
| } | |
| [AttributeUsage(AttributeTargets.Class|AttributeTargets.Interface)] | |
| public sealed class EventAttribute : MessageAttribute | |
| { |
This file contains hidden or 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
| static class LastInputHelper | |
| { | |
| /// <remarks>http://www.pinvoke.net/default.aspx/user32.GetLastInputInfo</remarks> | |
| [DllImport("User32.dll")] | |
| static extern bool GetLastInputInfo(ref LASTINPUTINFO plii); | |
| struct LASTINPUTINFO | |
| { | |
| public uint cbSize; | |
| public uint dwTime; |
This file contains hidden or 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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading; | |
| using NServiceBus.Features; | |
| using NServiceBus.Gateway.Deduplication; | |
| // Usage: | |
| // | |
| // busConfiguration.UsePersistence<NoGatewayDeduplicationPersistence, StorageType.GatewayDeduplication>(); |
This file contains hidden or 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
| using System; | |
| using System.Collections.Generic; | |
| using System.Configuration; | |
| using System.Runtime.CompilerServices; | |
| using NServiceBus; | |
| using NServiceBus.Features; | |
| using NServiceBus.Gateway.Deduplication; | |
| using NServiceBus.Persistence; | |
| /// <remarks>All collection operations are O(1)</remarks> |
This file contains hidden or 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
| using System; | |
| using System.Threading.Tasks; | |
| using NServiceBus; | |
| using NServiceBus.Pipeline; | |
| class Program | |
| { | |
| static async Task Main(string[] args) | |
| { | |
| var cfg = new EndpointConfiguration("test"); |