Commit f30c905f authored by yangxiaodong's avatar yangxiaodong

update samples.

parent ae2ce5fb
......@@ -24,7 +24,7 @@ namespace Sample.RabbitMQ.MySql.Controllers
public IActionResult PublishMessage()
{
_capBus.Publish("sample.rabbitmq.mysql", DateTime.Now);
return Ok();
}
......
......@@ -10,8 +10,8 @@ namespace Sample.RabbitMQ.SqlServer
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
//optionsBuilder.UseSqlServer("Server=192.168.2.206;Initial Catalog=TestCap;User Id=cmswuliu;Password=h7xY81agBn*Veiu3;MultipleActiveResultSets=True");
optionsBuilder.UseSqlServer("Server=DESKTOP-M9R8T31;Initial Catalog=Sample.Kafka.SqlServer;User Id=sa;Password=P@ssw0rd;MultipleActiveResultSets=True");
optionsBuilder.UseSqlServer("Server=192.168.2.206;Initial Catalog=TestCap;User Id=cmswuliu;Password=h7xY81agBn*Veiu3;MultipleActiveResultSets=True");
//optionsBuilder.UseSqlServer("Server=DESKTOP-M9R8T31;Initial Catalog=Sample.Kafka.SqlServer;User Id=sa;Password=P@ssw0rd;MultipleActiveResultSets=True");
}
}
}
......@@ -35,13 +35,9 @@ namespace Sample.RabbitMQ.SqlServer.Controllers
[Route("~/publish")]
public IActionResult PublishMessage()
{
var person = new Person { Name = "宜兴", Age = 11 };
_dbContext.Persons.Add(person);
_dbContext.SaveChanges();
throw new Exception();
//_capBus.Publish("sample.rabbitmq.mysql22222", DateTime.Now);
_capBus.Publish("sample.rabbitmq.mysql33333", person);
_capBus.Publish("sample.rabbitmq.mysql22222", DateTime.Now);
// _capBus.Publish("sample.rabbitmq.mysql33333", person);
return Ok();
}
......
......@@ -19,7 +19,13 @@ namespace Sample.RabbitMQ.SqlServer
services.AddCap(x =>
{
x.UseEntityFramework<AppDbContext>();
x.UseRabbitMQ("localhost");
x.UseRabbitMQ(xx =>
{
xx.HostName = "192.168.2.206";
xx.UserName = "admin";
xx.Password = "123123";
});
x.UseDashboard();
});
services.AddMvc();
......@@ -33,6 +39,8 @@ namespace Sample.RabbitMQ.SqlServer
app.UseMvc();
app.UseCap();
app.UseCapDashboard();
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment