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) ); }
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) //); }
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); }); }
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(); }
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 }
// POST api/command public void PostProduct(Command item) { var commandMessage = new CommandMessage {Id = item.Id, Name = item.Name}; NServiceBusBootstrapper.Bus.Send(commandMessage); }