Commit Graph

220 Commits

Author SHA1 Message Date
LM ea5dc12c5d metadata, etag, options, etc are optional 2020-03-06 11:29:40 -08:00
LM 6e6aadf779 More DaprClient logic 2020-03-06 00:31:01 -08:00
Aman Bhardwaj 642ae4108a Moving State api to grpc and adding helpers to unittest grpc calls. 2020-03-05 14:24:53 -08:00
Aman Bhardwaj bbbab1a49c Renaming base class to DaprClient and implementation calss to DparClientGrpc 2020-03-04 20:29:33 -08:00
Aman Bhardwaj b62a4c67be Removing individual clients for publish 2020-03-04 18:57:21 -08:00
Aman Bhardwaj b54eed453a Adding unit tests for publishevent api 2020-03-04 18:56:24 -08:00
Aman Bhardwaj d16f8b61ef updating the method name for publish 2020-03-04 13:54:02 -08:00
Aman Bhardwaj e8d90683b2 Adding DaprClientBuilder and adding methods for Publish 2020-03-04 13:49:39 -08:00
Aman Bhardwaj c07e1cf654 adding IDAprClient interface 2020-02-28 10:10:50 -08:00
Carlos Landeras 334766c28a
Pass serializer options to InvokeMethodAsync<TRequest,TResponse> #234 (#235)
* Pass serializer options to InvokeMethodAsync<TRequest,TResponse>

* Fix invoke method serializer options + tests

* Change assertion to already defined response object
2020-02-26 09:20:52 -08:00
Aman Bhardwaj c6b41944a6
Serializing actors tate as json by default. (#231) 2020-02-24 17:59:10 -08:00
Nkosinathi Sangweni d7fea33c45
Malotho/making actorstestable (#229)
* Getting started with Actor testability

* Added unitests against the Actor Class.
This is to verify that there are no breaking changes, and that the actor class can take any ActorStateManager.

* removed the private constructor

* resolving an issue with causing a null reference exception.
This was caused by an incorrect order of assignment in the constructor.
2020-02-21 22:10:06 -08:00
Aman Bhardwaj 7005e24624
REmoving dependency on Newtonsoft (#227) 2020-02-19 10:46:30 -08:00
Aman Bhardwaj ea51561f49
git gui, ading editor config and removing depenency on StyleCop.Analyzers (#228) 2020-02-18 13:21:12 -08:00
Aman Bhardwaj b1157cbc4f Revert "Malotho/making actorstestable (#220)"
This reverts commit 1bacce6734.
2020-02-15 09:41:37 -08:00
Nkosinathi Sangweni 1bacce6734
Malotho/making actorstestable (#220)
* Getting started with Actor testability

* Added unitests against the Actor Class.
This is to verify that there are no breaking changes, and that the actor class can take any ActorStateManager.

* removed the private constructor
2020-02-14 09:16:37 -08:00
Leon Mai 8d800e200a
Merge pull request #218 from dapr/update_sampledoc
Updating readme for Actor Sample to clarify client invocation.
2020-02-12 14:06:09 -08:00
Aman Bhardwaj 50d8a496bc addressing review comments 2020-02-12 14:03:04 -08:00
Aman Bhardwaj 4186f5af6f Updating readme for Actor Sample to clarify client invocation. 2020-02-12 13:27:22 -08:00
Aman Bhardwaj f12519233e
Removing extra isntructions from grpcclient readme 2020-02-12 09:51:44 -08:00
pacodelacruz 114f1065ed
Update 'samples/Actor' to show Timer and Reminder functionality (#213)
* Updated samples/Actor to show Timer and Reminder functionality

* Updated ActorClient. Changed deregistration of TImer and Reminder at the end of the program

Co-authored-by: Leon Mai <lemai@microsoft.com>
Co-authored-by: Aman Bhardwaj <amanbha@users.noreply.github.com>
2020-02-06 14:53:14 -08:00
Dr Christian Geuer-Pollmann bc9de4f813
Close #208 (#209)
* The .NET API states that passing `period: TimeSpan.FromMilliseconds(-1)` to `RegisterReminderAsync` should mean that the riminder never triggers on a recurrence.
When doing so, the serialization of the reminder means that
`IRemindable.ReceiveReminderAsync()` will be called with the dueTime value passed in the state parameter.

I figured that out because I passed an UTF8 JSON string as state, and `IRemindable.ReceiveReminderAsync()` received "0h0m0s1ms" as state, instead of my own value.

## Repro

```csharp
namespace Core.Application.Common.ActorImplementations
{
    using System;
    using System.Text;
    using System.Threading.Tasks;
    using Newtonsoft.Json;
    using Dapr.Actors;
    using Dapr.Actors.Runtime;
    using Core.Domain;

    public class FlightServiceQueryActorState
    {
        public string CoordinatorId { get; set; }

        public byte[] ToBytes() => Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(this));

        public static FlightServiceQueryActorState FromBytes(byte[] bytes) => JsonConvert.DeserializeObject<FlightServiceQueryActorState>(Encoding.UTF8.GetString(bytes));
    }

    [Actor(TypeName = ActorNames.FlightServiceQueryActor)]
    public class FlightServiceQueryActor : Actor, IRemindable, IFlightServiceQueryActor
    {
        public FlightServiceQueryActor(ActorService actorService, ActorId actorId) : base(actorService, actorId) { }

        const string AfterTickReminder = "AfterTick";
        static readonly TimeSpan Never = TimeSpan.FromMilliseconds(-1);

        async Task IFlightServiceQueryActor.Tick(string senderId, int duration)
        {
            var state = new FlightServiceQueryActorState { CoordinatorId = senderId };

            await base.RegisterReminderAsync(
                reminderName: AfterTickReminder,
                state: state.ToBytes(),
                dueTime: TimeSpan.FromMilliseconds(1),
                period: Never);

            await Console.Out.WriteLineAsync($"Tick tock {this.Id.GetId()}");
        }

        async Task IRemindable.ReceiveReminderAsync(string reminderName, byte[] stateBytes, TimeSpan dueTime, TimeSpan period)
        {
            var state = FlightServiceQueryActorState.FromBytes(stateBytes);

            var coordinator = ActorProxies.CreateFlightTravelCoordinationFor(state.CoordinatorId);

            await Console.Out.WriteLineAsync($"Reminder {this.Id.GetId()} -- {state.CoordinatorId}");
        }
    }
}
```

## Result

```text
time="2020-01-25T11:37:35+01:00" level=error msg="error executing reminder: error from actor service: "
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HLT1GA8OGV6N", Request id "0HLT1GA8OGV6N:00000006": An unhandled exception was thrown by the application.
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
   at Dapr.Actors.Runtime.ConverterUtils.ConvertTimeSpanFromDaprFormat(String valueString) in C:\github\dapr\dotnet-sdk\src\Dapr.Actors\Runtime\ConverterUtils.cs:line 28
   at Dapr.Actors.Runtime.ReminderInfo.DeserializeAsync(Stream stream) in C:\github\dapr\dotnet-sdk\src\Dapr.Actors\Runtime\ReminderInfo.cs:line 56
   at Dapr.Actors.Runtime.ActorManager.FireReminderAsync(ActorId actorId, String reminderName, Stream requestBodyStream, CancellationToken cancellationToken) in C:\github\dapr\dotnet-sdk\src\Dapr.Actors\Runtime\ActorManager.cs:line 162
   at Dapr.Actors.AspNetCore.RouterBuilderExtensions.<>c.<<AddReminderRoute>b__4_0>d.MoveNext() in C:\github\dapr\dotnet-sdk\src\Dapr.Actors.AspNetCore\RouterBuilderExtensions.cs:line 101
```

* Serializes DueTime and Period only when non-negative

* Empty values become default

* Not checking dueTime for negative values. Missing reminder attributes or empty string reminders are equal to "never".

Co-authored-by: Aman Bhardwaj <amanbha@users.noreply.github.com>
2020-02-06 14:35:33 -08:00
Shalabh Mohan Shrivastava 5b8a426e7d
Add support in dotnet client sdk to support multi state store support (#207)
* Including state Store name in the APIs to support multi state store scenario in SDK

* correcting the typo in the comment.

* Respective Changes to the tests

* Changes in StateAttribute and Binder classes to support state store name

* Changes in StateEntryModelBinderTests

* StoreName changes in the Integration test app

* fixing build issues

* Fixing integration tests

* Addressing review comments.

* Addressing review comments

* Updating samples to use correct state store name as generated by dapr cli.

Co-authored-by: Aman Bhardwaj <amanbha@users.noreply.github.com>
2020-02-06 09:06:21 -08:00
Aman Bhardwaj a5078a60c7
Using 127.0.0.1 instead of localhost. (#214)
* Using 127.0.0.1 instead of localhost.

* Updating usage in tests and samples, docs as well.
2020-02-05 12:32:41 -08:00
James Eastham 9e7ce7ee1e
Add PublishHttpClient implementation (#186) (#200)
* Add PublishHttpClient implementation (#186)

* Update PublishHttpClient implementation (#186)

* Refactor AsyncJsonContent to seperate class (#186)
2020-02-05 12:03:34 -08:00
pacodelacruz 68f74e512c
Updated samples/actor/readme.me. Fixed minor issues. Updated to improve readibility and based on markdown practices. (#212) 2020-02-04 18:31:51 -08:00
Shalabh Mohan Shrivastava 5a467bbfb8
Updating new proto files from dapr repo and fixing the gRPC sample (#205)
* Placing new proto file from dapr repo, generated from multistate store change

* Resolving code review comments - fixing the sample code.

Tested the sample with the changes.
2020-01-19 14:42:44 -08:00
Aman Bhardwaj c90f23778f
Updating version to 0.4.0 for next release 2020-01-16 16:19:32 -08:00
Aman Bhardwaj ea0c4436f7
Updating build CI to upload nugets to tagged github releases. (#203)
* enabling release publish

* addign script to get tag version

* Updating workflow

* updating workflow

* updating workflow

* updating workflow

* switching to ubuntu

* updating patht o nugets

* updating workflow

* updating workflow

* Updating workflow

* updating workflow

* Updating workflow.

* Update sdk_build.yml

* clean up

* add body

Co-authored-by: Young Bu Park <youngp@microsoft.com>
2020-01-16 16:18:40 -08:00
Ryan Nowak b02aa3f02b Add support for delete operations (#198)
* Add support for delete operations

* Removing extra spaces to fix build break.

Co-authored-by: Aman Bhardwaj <amanbha@users.noreply.github.com>
2020-01-09 09:53:13 -08:00
Ryan Nowak c4f80f10b6 Fix URL generation when BaseAddress is used (#194)
Fixes: #192

We were missing tests for the case where the HttpClient has a
BaseAddress set. In these case we'd generate an incorrect URL.

Co-authored-by: Aman Bhardwaj <amanbha@users.noreply.github.com>
2020-01-08 11:41:45 -08:00
Ryan Nowak 793c0a4a36 Get the integration tests to calm down (#195)
Removes console spew when running the integration tests at the command
line

Fixes: #193
2020-01-08 11:36:55 -08:00
Aman Bhardwaj f5cd830cc2
Fixing Deserialization of Reminder state (#191) 2019-12-18 11:31:23 -08:00
Aman Bhardwaj 34835a0224
Build for net core 3.1 (#189) 2019-12-16 09:31:25 -08:00
Aman Bhardwaj 9a499176bf Revert "Build for net core 3.1"
This reverts commit bead12b1d8.
2019-12-15 09:59:08 -08:00
Mehmet Tüken c10e772613 Grpc from proto (#154)
* remove generated protoc class.

* adding protos files and update project files.

* update Grpc.Net.Client to 2.25.0

* Grpc.Net.Client and Grpc.Tools making private assets.
Bump Google.Protobuf 3.10.0 to 3.11.2.
2019-12-14 14:02:18 -08:00
Aman Bhardwaj bead12b1d8 Build for net core 3.1 2019-12-13 20:31:08 -08:00
James Eastham 5562d0d64b Issue 184 (#185)
* Add InvokeClient and InvokeHttpClient dapr #184

* Add tests for InvokeHttpClient dapr#184

* Update namespace of InvokeHttpClient  dapr#184

* Add DI of InvokeHttpClient dapr#184

* Resolve code format issues dapr#184

* Remove InvokeEnvelope and add params to InvokeMethod dapr#184

* Update method signature to use generic types for Request/Response dapr#184

* Update parameter in data null check dapr#184
2019-12-13 10:05:17 -08:00
Aman Bhardwaj f10155a1d3
Removing an extra quote from docs. 2019-12-10 09:09:09 -08:00
Greg Ingram 413f6c777f Update error codes usage in dotnet-sdk (#175)
* Update error codes

* Added missing error enums

* Attempt to group
2019-12-09 17:44:06 -08:00
Aman Bhardwaj 504ee8fb9c
Updating aspnetcore sample docs to include commands for windows (#181) 2019-12-06 17:03:37 -08:00
Aman Bhardwaj 21c88f8795
Making Serialization, Deserialization of ReminderInfo, Timer async and using System.Text.Json for Reminder, Timer and State, (#178)
* Making Serialization, Deserialization of ReminderInfo, Timer async and using System.Text.Json for Reminder, Timer and State,

* Updating tests.

* Addressing review comment: Passing stream directly to serializer.

* Removing dependency on Newtonsoft.Json

* Revert "Removing dependency on Newtonsoft.Json"

This reverts commit 0315781bd0.
2019-12-04 11:39:39 -08:00
Aman Bhardwaj 6a52323822
Fixing Unregisterin of timers (#176) 2019-12-03 14:13:12 -08:00
Greg Ingram 0ea56da823 Removed double word (#174) 2019-11-30 22:54:19 -08:00
Greg Ingram 4d02d0a1fa Fixed typo (#172) 2019-11-25 15:59:28 -08:00
Phillip Hoff 916d552279 Allow explicit actor type (#165)
* Refactored ActorRuntime to allow testing.

* Add test for inferred actor type.

* Add RegisterActor() overload.

* Consolidate RegisterActor() implementations.

* Refactor to make type still intrinsic to actor implementation.

* Update docs.

* Revert error codes change.

* Updates per PR feedback.

* Add warning to ActorRuntime constructor.
2019-11-25 09:30:18 -08:00
Ross McDermott 7875ef3da9 Fix spelling mistake (#169) 2019-11-21 18:17:26 -08:00
Greg Ingram 3a7a19c9b1 Edit JSON to uppercase (#168)
* Edit JSON to uppercase

* Updated a few more
2019-11-21 18:01:06 -08:00
Felix Svensson 8af6fb038e Updated summary on classes (#166)
* updated description of actor service

* Updated summary for IActorService
2019-11-20 20:37:31 -08:00
Greg Ingram c48a3c814f Capitalize Dapr throughout comments (#161) 2019-11-18 17:35:32 -08:00