瀏覽代碼

update samples

master
Savorboard 6 年之前
父節點
當前提交
8bee1d4369
共有 1 個檔案被更改,包括 6 行新增2 行删除
  1. +6
    -2
      samples/Sample.RabbitMQ.MySql/Controllers/ValuesController.cs

+ 6
- 2
samples/Sample.RabbitMQ.MySql/Controllers/ValuesController.cs 查看文件

@@ -37,10 +37,14 @@ namespace Sample.RabbitMQ.MySql.Controllers
public async Task<IActionResult> PublishMessageWithTransaction()
{
using (var trans = await _dbContext.Database.BeginTransactionAsync())
using (var capTrans = _capBus.CapTransaction.Begin(trans))
{
await _capBus.PublishAsync("sample.kafka.sqlserver", "");
for (int i = 0; i < 10; i++)
{
await _capBus.PublishAsync("sample.rabbitmq.mysql", DateTime.Now);
}

trans.Commit();
capTrans.Commit();
}
return Ok();
}


Loading…
取消
儲存