static void ConfigureBusEndpoints(IServiceBusBusFactoryConfigurator cfg, IServiceProvider provider, IServiceBusHost host) { const string subsriberName = "AnotherSubscriber"; cfg.SubscriptionEndpoint <AnotherThingHappened>(host, subsriberName, configurator => { configurator.Handler <AnotherThingHappened>(context => { Console.WriteLine(context.Message.AnotherThingType); if (Random.NextDouble() < 0.1) { throw new Exception("Oups, I failed :("); } return(Task.CompletedTask); }); }); cfg.SubscriptionEndpoint <ObjectCreatedA>(host, subsriberName, configurator => { configurator.Consumer <ObjectACreatedEventHandler>(); }); cfg.ReceiveEndpoint(host, queueName: "AnotherSubscirber2", configure: configurator => { configurator.Handler <ObjectCreatedB>(async context => { Console.WriteLine("Another subscirber, object b created"); await context.SchedulePublish <ScheduledCommand>(TimeSpan.FromSeconds(30), new ScheduledCommandImpl { ExecutedIn = 30, IsReallyScheduled = true }); ChangeCaseCommand changeCase = new ChangeCaseCommandImpl { IsScheduled = true, Text = "Hello world" }; await context.ScheduleSendConventional(TimeSpan.FromSeconds(15), changeCase); }); }); cfg.CreateConventionalCommandHandlerEndpoint <DoAnotherThingCommandHandler, DoAnotherThingCommand>(provider); }