Releases: dolittle/DotNET.SDK
Release v9.0.0
Summary
Changes the behavior of the pinging system to be more reliable and to be ready to receive pings immediately upon connecting to the Runtime. This is to deal with a bug that was causing connections between the SDK and the Runtime to be dropped. This is a breaking behavioral change and it's related to the release of version 6.0.0
of the Runtime. You have to update to version 6.*
of the Runtime, older versions wont work with this release of the SDK. For this we've added a compatibility table.
Also adds a new way of specifying the ping interval period, which defines how often the client expects a ping from the Runtime. If the Runtime fails to ping after 3 attempts, the client will disconnect. The default value of the interval is 5 seconds.
Added
- You can now specify the ping interval during client building with the
WithPingInterval(TimeSpan)
call. By default it's 5 seconds.
Changed
- The reverse call connections are now ready to start receiving pings and writing pong immediately upon connecting.
- Changed back to the old implementation of the reverse call clients without RX.
Fixed
- Event Horizon connections will now keep retrying forever properly.
- Pinging system should now timeout a lot less than before.
Prerelease v8.5.0-timeout.4
Making EventHorizon subscriptions retry forever - it has a backoff of 1 second multiplied by retry counts. So eventually it will take forever before it retries.
Prerelease v8.5.0-timeout.3
- Copied ReverseCallClient implementation from the Runtime (the old one without RX)
- Allow ping messages before ConnectResponse
Prerelease v8.5.0-timeout.2
Summary
Potentially fixes a problem with reverse calls
Fixed
- Switch the place on a cancellation token source cancellation and Observable.OnError()
Removed
- Sleep on messages from server
Prerelease v8.5.0-timeout.1
Summary
Seemingly fixes a strange ping timeout issue by adding a Thread.Sleep(20)
for each received Ping from the Runtime.
Fixed
- Ping timeout issues?
Prerelease v8.5.0-timeout.0
Merge pull request #58 from dolittle/custom-timeout With Timeout
Release v8.4.0
Summary
Adds Projections, that are a special type of event handler dealing with read models. Projections can be defined either inline in the client build steps, or declaratively with [Projection()]
attribute.
Example of writing a Projection inline and registering a declared one:
var client = Client
.ForMicroservice("f39b1f61-d360-4675-b859-53c05c87c0e6")
.WithEventTypes(eventTypes =>
{
eventTypes.Register<DishPrepared>();
eventTypes.Register<ChefFired>();
})
.WithProjections(projections =>
{
projections.CreateProjection("4a4c5b13-d4dd-4665-a9df-27b8e9b2054c")
.ForReadModel<Chef>()
.On<DishPrepared>(_ => _.KeyFromProperty(_ => _.Chef), (chef, @event, ctx) =>
{
chef.Name = @event.Chef;
chef.Dishes.Add(@event.Dish);
return chef;
})
.On<ChefFired>(_ => _.KeyFromProperty(_ => _.Chef), (chef, @event, ctx) =>
{
return ProjectionResult<Chef>.Delete;
});
projections.RegisterProjection<Menu>();
})
.Build();
Example of a declared projection:
[Projection("0405b93f-1461-472c-bdc2-f89e0afd4dfe")]
public class Menu
{
public List<string> Dishes = new List<string>();
[KeyFromEventSource]
public void On(DishPrepared @event, ProjectionContext context)
{
if (!Dishes.Contains(@event.Dish)) Dishes.Add(@event.Dish);
}
}
Example of getting projections:
var menu = await client.Projections
.ForTenant(TenantId.Development)
.Get<Menu>("bfe6f6e4-ada2-4344-8a3b-65a3e1fe16e9")
.ConfigureAwait(false);
System.Console.WriteLine($"Menu consists of: {string.Join(", ", menu.State.Dishes)}");
var allChefs = await client.Projections
.ForTenant(TenantId.Development)
.GetAll<Chef>()
.ConfigureAwait(false);
foreach (var chef in allChefs)
{
System.Console.WriteLine($"Chef name: {chef.State.Name} and prepared dishes: {string.Join(",", chef.State.Dishes)}");
}
Added
- New
client.WithProjections()
to build Projections inline in the clients build steps. - Classes can be attributed with
[Projection('projectionId')]
to declare them as Projections (just like you can do with EventHandlers). The class itself becomes the readmodel for the projection. On()
methods are the handlers for a Projection. They can be decorated with different attributes to declare the key to the projection.- Get the state of a Projection with
client.Projections.Get<ReadModel>(key)
andclient.Projections.GetAll<ReadModel>()
(+ other overloads). - Sample for how to use Projections in Samples/Tutorials/Projections.
Changed
- Sample directory structure and moved the tutorials around
Prerelease v8.4.0-projections.2
Summary
Upgrade to latest contracts prerelease, more flexible methods for getting projections through IProjectionStore
, and make code a bit more robust in the ProjectionProcesssor
.
Added
- Overloads to IProjectionStore to get untyped projection states.
- Allow setting scope for a projection with the inline API after choosing readmodel type.
Changed
- Adhere to new structure of contracts (prerelease 11)
- Reuse more robust converter (from Projections.Store) in ProjectionProcessor
Prerelease v8.4.0-projections.1
Summary
Adds the ability to get projections.
Added
- API for getting one or all projections of a specific projection type
Prerelease v8.4.0-projections.0
Summary
Adds projections
Added
- Support for building and registering projections