예제 #1
0
        static async Task AsyncMain()
        {
            var configuration = new BusConfiguration();

            configuration.EndpointName("Minion");
            configuration.ScaleOut().UniqueQueuePerEndpointInstance(ConfigurationManager.AppSettings["minion.name"]);
            configuration.UseSerialization <JsonSerializer>();
            configuration.UsePersistence <InMemoryPersistence>();
            configuration.EnableInstallers();
            configuration.SendFailedMessagesTo("error");

            var endpoint = await Endpoint.Start(configuration);

            ColouredConsole.WriteLine("Bello!");
            Console.WriteLine("Press any key to exit");

            Console.ReadLine();
            await endpoint.Stop();
        }
예제 #2
0
 public Task Handle(Dun message, IMessageHandlerContext context)
 {
     ColouredConsole.WriteLine($"Good minion, {message.By}.");
     return(Task.FromResult(0));
 }
 public async Task Handle(DoSomethingNaughty message, IMessageHandlerContext context)
 {
     ColouredConsole.WriteLine("Para tu, Gru!");
     await context.Reply <Dun>(m => m.By = MinionName);
 }