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
| Configure.With(...) | |
| .Transport(t => t.UseRabbitMq(...) //< giver en RabbitMqOptions | |
| .PrefetchCount(5)) |
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
| public class SomeDoc : Doc | |
| { | |
| public Ref<AnotherDoc> TheOtherDoc { get; set; } | |
| } | |
| public class AnotherDoc : Doc | |
| { | |
| public string Text { get; set; } | |
| } |
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
| public interface ILoadAggregateRoots | |
| { | |
| T Load<T>(string id) where T:Doc; | |
| } | |
| public static class Loader | |
| { | |
| static ILoadAggregateRoots currentLoader = new ThrowMustProvideLoaderException(); | |
| public static ILoadAggregateRoots Current |
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
| sqlReplicate('SomeTable', { | |
| Id: documentId, | |
| SomeIntegerColumn: 23 | |
| }); |
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
| Configure.With(...) | |
| .EnableWebCallbacks() | |
| .(...) | |
| // (...) | |
| // just like that | |
| adapter.Bus.Send(new SomeRequest {Message = "hello there!"}, | |
| (SomeReply reply) => | |
| { |
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
| Action<MyDomainAssembly.ISubscribeTo<MyDomainAssembly.IDomainEvent>, MyDomainAssembly.IDomainEvent> | |
| dispatchSpecification = (s, e) => s.Handle(e); | |
| Action<MyDomainAssembly.IDomainEvent> myDispatcher = | |
| DomainEvents.Configure.With(someIocContainerAdapter) | |
| .DefineSubscriberAs<MyDomainAssembly.ISubscribeTo<MyDomainAssembly.IDomainEvent>>(dispatchSpecification) | |
| .RegisterSubscribersFromAssemblyContaining<MyDomainAssembly.SomeConcreteSubscriber>(Lifestyle.InstancePerCall) | |
| .RegisterSubscribersFromAssemblyContaining<MyInfrastructureAssembly.AnotherConcreteSubscriber>(Lifestyle.InstancePerCall) | |
| .CreateDispatcher(); |
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
| public async Task<HttpResponseMessage> Get() | |
| { | |
| var blobClient = GetBlobClientFromSomewhere(); | |
| var imagesContainer = blobClient.GetContainerReference("images"); | |
| var blobRef = await imagesContainer.GetBlobReferenceFromServerAsync(@"cute_cats_70MB.jpg"); | |
| var openRead = await blobRef.OpenReadAsync(); | |
| var response = new HttpResponseMessage(HttpStatusCode.OK) |
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
| try | |
| { | |
| var startableBus = Configure.With(new BuiltinContainerAdapter()) | |
| .Logging(l => l.None()) | |
| .Transport(t => t.UseMsmqInOneWayClientMode()) | |
| .CreateBus(); | |
| using (var bus = startableBus.Start()) | |
| { | |
| bus.Advanced.Routing.Send("NO_CHANCE_THAT_THIS_QUEUE_EXISTS", "hello there!"); |
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; | |
| using System.Threading.Tasks; | |
| using Rebus.Logging; | |
| namespace Rebus.Threading | |
| { | |
| /// <summary> | |
| /// <see cref="Task"/>-based background timer thingie, that will periodically call an async <see cref="Func<Task>"/> | |
| /// </summary> |
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
| public static class SubscriberCacheExtensions | |
| { | |
| public static void EnableSubscriberCache(this OptionsConfigurer configurer) | |
| { | |
| configurer.Decorate<ISubscriptionStorage>(c => | |
| { | |
| var subscriptionStorage = c.Get<ISubscriptionStorage>(); | |
| return new CachingSubscriptionStorage(subscriptionStorage); | |
| }); |