Ejemplo n.º 1
0
        public void Handle(BrokeredMessage message)
        {
            DemoPrintouts.Begin("Relaying Echo Response Event ... ");
            var echoedResponse = message.To <EchoedResponseModel>().Result;

            foreach (var property in message.Properties)
            {
                _bus.SetMessageHeader(echoedResponse, property.Key, property.Value.ToString());
            }

            _bus.Publish <EchoedResponse>(echoedResponse);
            message.Complete();
            DemoPrintouts.End("Done!");
        }
Ejemplo n.º 2
0
        public void Handle(PleaseRepeatThis message)
        {
            DemoPrintouts.Begin("Relaying Echo Command ... ");

            var brokeredMessage = Interop.CreateMessage(message, Bus.CurrentMessageContext.Id);

            // Break free from the local transaction and unconditionally send this message.
            // If it fails (throws an exception, we'll try again)
            // If it succeeds AND throws an exception, ASB's Duplicate message detection will take discard the duplicate message
            using (var scope = new TransactionScope(TransactionScopeOption.Suppress))
            {
                MessageSender.Send(brokeredMessage);
                scope.Complete();
                DemoPrintouts.End("Done!");
            }
        }
Ejemplo n.º 3
0
        public static void Handle(BrokeredMessage message, IBus bus)
        {
            DemoPrintouts.Begin("Relaying Math Command ... ");

            var mutateValueModel = message.To <MutateValueCommandModel>().Result;

            bus.Send <MutateValue>(value => {
                value.Operand  = mutateValueModel.Operand;
                value.Operator = mutateValueModel.Operator;

                //foreach (var property in message.Properties)
                //{
                //    bus.SetMessageHeader(value, property.Key, property.Value.ToString());
                //}
            });

            message.Complete();
            DemoPrintouts.End("Done!");
        }
Ejemplo n.º 4
0
 public void Handle(EchoedResponse message)
 {
     DemoPrintouts.End("Received an echo response: " + message.EchoedPhrase);
 }
Ejemplo n.º 5
0
 public void Handle(Subscriptions.ResultChanged message)
 {
     DemoPrintouts.End("Received an math response: " + message.Result);
 }