Skip to content

Commit

Permalink
Configurable AckWait setting for NATS message redelivery (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraliv13 authored Feb 11, 2020
1 parent 9d4641b commit 1600b12
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
65 changes: 33 additions & 32 deletions src/Messaging/NBB.Messaging.Nats/NBB.Messaging.Nats.csproj
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>Nats messaging</Description>
</PropertyGroup>

<ItemGroup>
<None Remove="Charisma.BuildingBlocks.Messaging.Nats.csproj.vspscc" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="$(MicrosoftExtensionsPackagesVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsPackagesVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackagesVersion)" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftExtensionsPackagesVersion)" />
<PackageReference Include="NATS.Client" Version="0.8.1" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
<PackageReference Include="STAN.Client" Version="0.1.5" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NBB.Messaging.Abstractions\NBB.Messaging.Abstractions.csproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>Nats messaging</Description>
</PropertyGroup>

<ItemGroup>
<None Remove="Charisma.BuildingBlocks.Messaging.Nats.csproj.vspscc" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="$(MicrosoftExtensionsPackagesVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackagesVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsPackagesVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackagesVersion)" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftExtensionsPackagesVersion)" />
<PackageReference Include="NATS.Client" Version="0.8.1" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
<PackageReference Include="STAN.Client" Version="0.1.5" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NBB.Messaging.Abstractions\NBB.Messaging.Abstractions.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private Task SubscribeToTopicAsync(string subject, Func<string, Task> handler, C

//https://github.com/nats-io/go-nats-streaming#subscriber-rate-limiting
opts.MaxInflight = 1;
opts.AckWait = 50000;
opts.AckWait = _configuration.GetSection("Messaging").GetSection("Nats").GetValue<int?>("ackWait") ?? 50000;

void StanMsgHandler(object obj, StanMsgHandlerArgs args)
{
Expand Down

0 comments on commit 1600b12

Please sign in to comment.