I have the following code:
public async Task<IActionResult> Post([FromBody]CreateActivity command)
{
command.Id = Guid.NewGuid();
command.CreatedAt = DateTime.UtcNow;
await _busClient.PublishAsync(command);
return Accepted($"activities/{command.Id}");
}
It seems like 'PublishAsync' method is missing in RabbitMq. This is my .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.0" />
<PackageReference Include="RawRabbit" Version="2.0.0-beta8" />
<PackageReference Include="RawRabbit.DependencyInjection.ServiceCollection" Version="2.0.0-beta8" />
<PackageReference Include="RawRabbit.Operations.Subscribe" Version="2.0.0-beta8" />
</ItemGroup>
</Project>
It is the same with all other stable versions.
答案 0 :(得分:2)
从the source code看,似乎PublishAsync
方法在RawRabbit.Operations.Publish NuGet包中定义为扩展方法:
使用PublishAsync丰富BusClient,用于执行BasicPublish