Browse Source

update sample

master
yangxiaodong 7 years ago
parent
commit
287307b6bc
4 changed files with 14 additions and 6 deletions
  1. +10
    -3
      samples/Sample.RabbitMQ.SqlServer/Controllers/ValuesController.cs
  2. +1
    -1
      samples/Sample.RabbitMQ.SqlServer/Program.cs
  3. +2
    -1
      samples/Sample.RabbitMQ.SqlServer/Services/Impl/OrderService.cs
  4. +1
    -1
      samples/Sample.RabbitMQ.SqlServer/Startup.cs

+ 10
- 3
samples/Sample.RabbitMQ.SqlServer/Controllers/ValuesController.cs View File

@@ -35,9 +35,16 @@ namespace Sample.RabbitMQ.SqlServer.Controllers
[Route("~/publish")] [Route("~/publish")]
public IActionResult PublishMessage() public IActionResult PublishMessage()
{ {
_capBus.Publish("sample.rabbitmq.mysql22222", DateTime.Now);
// _capBus.Publish("sample.rabbitmq.mysql33333", person);

_capBus.Publish("sample.rabbitmq.sqlserver.order.check", DateTime.Now);

//var person = new Person
//{
// Name = "杨晓东",
// Age = 11,
// Id = 23
//};
//_capBus.Publish("sample.rabbitmq.mysql33333", person);


return Ok(); return Ok();
} }


+ 1
- 1
samples/Sample.RabbitMQ.SqlServer/Program.cs View File

@@ -24,7 +24,7 @@ namespace Sample.RabbitMQ.SqlServer


//host.Run(); //host.Run();
public static void Main(string[] args) public static void Main(string[] args)
{
{
BuildWebHost(args).Run(); BuildWebHost(args).Run();
} }




+ 2
- 1
samples/Sample.RabbitMQ.SqlServer/Services/Impl/OrderService.cs View File

@@ -8,9 +8,10 @@ namespace Sample.RabbitMQ.SqlServer.Services.Impl
{ {
public class OrderService : IOrderService, ICapSubscribe public class OrderService : IOrderService, ICapSubscribe
{ {
[CapSubscribe("sample.rabbitmq.sqlserver.order.check")]
public void Check() public void Check()
{ {
throw new NotImplementedException();
Console.WriteLine("out");
} }
} }
} }

+ 1
- 1
samples/Sample.RabbitMQ.SqlServer/Startup.cs View File

@@ -13,7 +13,7 @@ namespace Sample.RabbitMQ.SqlServer
{ {
services.AddDbContext<AppDbContext>(); services.AddDbContext<AppDbContext>();


services.AddTransient<IOrderService, OrderService>();
services.AddScoped<IOrderService, OrderService>();
services.AddTransient<ICmsService, CmsService>(); services.AddTransient<ICmsService, CmsService>();


services.AddCap(x => services.AddCap(x =>


Loading…
Cancel
Save