public void ProcessMessage(HandlerContext <OrderCompletedEvent> context)
        {
            var comment = string.Format("Handled OrderCompletedEvent on Subscriber1: {0}", context.Message.OrderId);

            ColoredConsole.WriteLine(ConsoleColor.Blue, comment);

            context.Publish(new WorkDoneEvent
            {
                Comment = comment
            });
        }
示例#2
0
        public void ProcessMessage(HandlerContext <OrderCompletedEvent> context)
        {
            var comment = string.Format("Handled OrderCompletedEvent on Subscriber2: {0}", context.Message.OrderId);

            ColoredConsole.WriteLine(ConsoleColor.Blue, comment);

            context.Publish(new WorkDoneEvent
            {
                Comment = comment
            });

            context.Send(new WorkDoneEvent
            {
                Comment = "[DEFERRED / Subscriber2] : order id = " + context.Message.OrderId
            }, c => c.Defer(DateTime.Now.AddSeconds(5)).Reply());
        }
示例#3
0
        public void ProcessMessage(HandlerContext <RegisterMemberCommand> context)
        {
            Console.WriteLine();
            Console.WriteLine("[MEMBER REGISTERED] : user name = '{0}'", context.Message.UserName);
            Console.WriteLine();

            var memberRegisteredEvent = new MemberRegisteredEvent
            {
                UserName = context.Message.UserName
            };

            context.Publish(memberRegisteredEvent);

            if (!string.IsNullOrEmpty(context.TransportMessage.SenderInboxWorkQueueUri))
            {
                context.Send(new MemberRegisteredEvent
                {
                    UserName = context.Message.UserName
                }, c =>
                {
                    c.Reply();
                });
            }
        }