Skip to content

Commit

Permalink
Merge pull request #26 from petabridge/dev
Browse files Browse the repository at this point in the history
v0.2.0 Release
  • Loading branch information
Aaronontheweb authored Feb 15, 2019
2 parents b41f2e1 + dd2f2bf commit 2d09987
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 13 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ This package contains some additions to Akka.Persistence that many users commonl

You can read more about Akka.Persistence.Extras at: https://devops.petabridge.com/articles/msgdelivery/

You can install these tools via the [Akka.Persistence.Extras NuGet Package](https://www.nuget.org/packages/Akka.Persistence.Extras/)

```
PS> Install-Package Akka.Persistence.Extras
```

## `AtLeastOnceDeliveryActorV2`

The [`AtLeastOnceDeliveryActor` base type](https://getakka.net/api/Akka.Persistence.AtLeastOnceDeliveryActor.html) in its current form is a total non-pleasure to use in production, for the following reasons:
Expand Down
7 changes: 4 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#### 0.1.0 February 14 2019 ####
First release of Akka.Persistence.Extras. Introduces the [`DeDuplicatingReceiveActor` base class](https://devops.petabridge.com/api/Akka.Persistence.Extras.DeDuplicatingReceiveActor.html), which can be used to automatically strip out duplicates and guarantee that messages are processed exactly once by the actor.
#### 0.2.0 February 15 2019 ####
Minor, but breaking change release of Akka.Persistence.Extras.

You can read more about [how to use the `DeDuplicatingReceiveActor` with Akka.NET and other `AtLeastOnceDeliveryActor` instances here](https://devops.petabridge.com/articles/msgdelivery/deduplication.html).
* Changed targets to .NET 4.5 and .NET Standard 1.6, in order to temporarily bring the project inline with Akka.NET's targets. We will move back to targeting .NET Standard 2.0 eventually.
* Removed all dependencies on `System.ValueTuple` as this caused compilation issues on Linux with .NET Framework 4.5.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<IsPackable>false</IsPackable>
<RuntimeFrameworkVersion>2.1.6</RuntimeFrameworkVersion>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public bool AlreadyProcessed(long confirmationId, string senderId)

public IReadOnlyDictionary<string, DateTime> TrackedSenders => SenderLru;

public (IReceiverState newState, IReadOnlyList<string> prunedSenders) Prune(TimeSpan notUsedSince)
public PrunedResult Prune(TimeSpan notUsedSince)
{
var targetTime = CurrentTime - notUsedSince;
var prunedSenderIds = SenderLru.Where(x => x.Value <= targetTime).Select(x => x.Key).ToList();
return (
return new PrunedResult(
new DeDuplicatingReceiverModelState(SenderLru.RemoveRange(prunedSenderIds),
SenderIds.RemoveRange(prunedSenderIds), CurrentTime), prunedSenderIds);
}
Expand Down
3 changes: 1 addition & 2 deletions src/Akka.Persistence.Extras/Akka.Persistence.Extras.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>$(NetStandardLibVersion);$(NetFrameworkLibVersion)</TargetFrameworks>
<Description>Additional features and tools for the Akka.Persistence library.</Description>
</PropertyGroup>

Expand All @@ -12,5 +12,4 @@
<PackageReference Include="Akka.Persistence" Version="$(AkkaVersion)" />
<PackageReference Include="Petabridge.Collections" Version="1.0.0" />
</ItemGroup>

</Project>
22 changes: 19 additions & 3 deletions src/Akka.Persistence.Extras/DeDuplication/IReceiverState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ public enum ReceiveOrdering
StrictOrder
}

/// <summary>
/// Used to work around issues with value tuple syntax in older versions of the compiler.
/// </summary>
public struct PrunedResult
{
public PrunedResult(IReceiverState newState, IReadOnlyList<string> prunedSenders)
{
this.newState = newState;
this.prunedSenders = prunedSenders;
}

public IReceiverState newState { get; }

public IReadOnlyList<string> prunedSenders { get; }
}

/// <summary>
/// Interface for data structures used for tracking delivery state.
/// </summary>
Expand Down Expand Up @@ -79,7 +95,7 @@ public interface IReceiverState
/// already confirmed from them is effectively zero, therefore we're better off freeing up the memory
/// used to track them for other senders who might be doing work.
/// </remarks>
(IReceiverState newState, IReadOnlyList<string> prunedSenders) Prune(TimeSpan notUsedSince);
PrunedResult Prune(TimeSpan notUsedSince);

/// <summary>
/// Convert this object into a <see cref="IReceiverStateSnapshot" />
Expand Down Expand Up @@ -175,7 +191,7 @@ public bool AlreadyProcessed(long confirmationId, string senderId)

public IReadOnlyDictionary<string, DateTime> TrackedSenders => _trackedLru.ToImmutableDictionary();

public (IReceiverState newState, IReadOnlyList<string> prunedSenders) Prune(TimeSpan notUsedSince)
public PrunedResult Prune(TimeSpan notUsedSince)
{
var pruneTime = _timeProvider.Now.UtcDateTime - notUsedSince;

Expand All @@ -188,7 +204,7 @@ public bool AlreadyProcessed(long confirmationId, string senderId)
_trackedLru.Remove(senderId);
}

return (this, senderIds);
return new PrunedResult(this, senderIds);
}

public IReceiverStateSnapshot ToSnapshot()
Expand Down
9 changes: 6 additions & 3 deletions src/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
<PropertyGroup>
<Copyright>Copyright © 2015-2019 Petabridge</Copyright>
<Authors>Petabridge</Authors>
<VersionPrefix>0.1.0</VersionPrefix>
<PackageReleaseNotes>First release of Akka.Persistence.Extras. Introduces the [`DeDuplicatingReceiveActor` base class](https://devops.petabridge.com/api/Akka.Persistence.Extras.DeDuplicatingReceiveActor.html), which can be used to automatically strip out duplicates and guarantee that messages are processed exactly once by the actor.
You can read more about [how to use the `DeDuplicatingReceiveActor` with Akka.NET and other `AtLeastOnceDeliveryActor` instances here](https://devops.petabridge.com/articles/msgdelivery/deduplication.html).</PackageReleaseNotes>
<VersionPrefix>0.2.0</VersionPrefix>
<PackageReleaseNotes>Minor, but breaking change release of Akka.Persistence.Extras.
Changed targets to .NET 4.5 and .NET Standard 1.6, in order to temporarily bring the project inline with Akka.NET's targets. We will move back to targeting .NET Standard 2.0 eventually.
Removed all dependencies on `System.ValueTuple` as this caused compilation issues on Linux with .NET Framework 4.5.</PackageReleaseNotes>
<PackageIconUrl>https://petabridge.com/images/logo.png</PackageIconUrl>
<PackageProjectUrl>
https://devops.petabridge.com/articles/msgdelivery/
Expand All @@ -15,6 +16,8 @@ You can read more about [how to use the `DeDuplicatingReceiveActor` with Akka.NE
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
<PropertyGroup>
<NetFrameworkLibVersion>net45</NetFrameworkLibVersion>
<NetStandardLibVersion>netstandard1.6</NetStandardLibVersion>
<AkkaVersion>1.3.2</AkkaVersion>
<NBenchVersion>1.2.2</NBenchVersion>
<XunitVersion>2.4.1</XunitVersion>
Expand Down

0 comments on commit 2d09987

Please sign in to comment.