protected void Button1_Click(object sender, EventArgs e)
        {
            int number = int.Parse(TextBox1.Text);
            var command = new Command { Id = number };

            Global.Bus.Send(command).Register<ErrorCodes>(
                code => Label1.Text = Enum.GetName(typeof (ErrorCodes), code)
                );
        }
Exemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int number = int.Parse(TextBox1.Text);
            var command = new Command { Id = number };

            Global.Bus.Send(command)
                .Register<CommandReply>(reply=>Label1.Text="Reply = "+reply.Message);
                //.Register<ErrorCodes>(
                //code => Label1.Text = Enum.GetName(typeof (ErrorCodes), code)
                //);
        }
Exemplo n.º 3
0
        public void IndexAsync(string textField)
        {
            int number;
            if (!int.TryParse(textField, out number))
                return;

            var command = new Command { Id = number };
            Bus.Send(command).Register<int>(status=>
                                           {
                                               AsyncManager.Parameters["errorCode"] = Enum.GetName(typeof(ErrorCodes), status);
                                           });
        }
Exemplo n.º 4
0
        public ActionResult Index(string textField)
        {
            ViewBag.Title = "SendAndBlock";

            int number;
            if (!int.TryParse(textField, out number))
                return View();

            var command = new Command { Id = number };

            IAsyncResult res = Bus.Send(command).Register(SimpleCommandCallback, this);
            WaitHandle asyncWaitHandle = res.AsyncWaitHandle;
            asyncWaitHandle.WaitOne(50000);

            return View();
        }
Exemplo n.º 5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(TextBox1.Text))
            {
                return;
            }
            #region ActionHandling
            int number;
            if (!int.TryParse(TextBox1.Text, out number))
            {
                return;
            }
            Command command = new Command
                          {
                              Id = number
                          };

            Global.Bus.Send("Samples.AsyncPages.Server", command)
                .Register<ErrorCodes>(code => Label1.Text = Enum.GetName(typeof (ErrorCodes), code));
            #endregion
        }
Exemplo n.º 6
0
 // POST api/command
 public void PostProduct(Command item)
 {
     var commandMessage = new CommandMessage {Id = item.Id, Name = item.Name};
     
     NServiceBusBootstrapper.Bus.Send(commandMessage);
 }