Commit Graph

284 Commits

Author SHA1 Message Date
Leon Mai d8b5f77a81
Document + example for ConfigureActorSettings() (#276)
* #275 document + example for ConfigureActorSettings()

* make bold

Co-authored-by: LM <lemai>
Co-authored-by: Aman Bhardwaj <amanbha@users.noreply.github.com>
2020-03-31 15:46:16 -07:00
Aman Bhardwaj 917c9eaa38
Updating nuget pkg version to prepare for 0.7.0 release 2020-03-31 15:08:50 -07:00
Aman Bhardwaj d8157b9f5b
Consuming proto files for 0.6.0 dapr runtime and updating DaprClient for it. (#274) 2020-03-30 19:37:20 -07:00
Leon Mai 20fabb2141
Support more actor configuration (#269)
* 219 Support the granular Actor config such as actor idle time

* cleanup

* cr

* cr

* refactor

* remove now dead code

* Move setter into properties

Co-authored-by: LM <lemai>
2020-03-30 13:30:00 -07:00
Aman Bhardwaj 5732c7220c
Revert the workaround added to work with mTLS enabled grpc endpoint. (#270)
* Revert "Allows the DaprClient to work with mTLS enabled grpc endpoint when https endpoint is provided (#263)"

This reverts commit e0a3d9302a.

* exposes option to provide grpcchannel options to allow more customization by users.

* removing extra spaces
2020-03-30 10:43:11 -07:00
Aman Bhardwaj 1b44cfea3d
Add health api (#267) 2020-03-26 11:59:43 -07:00
Aman Bhardwaj e0a3d9302a
Allows the DaprClient to work with mTLS enabled grpc endpoint when https endpoint is provided (#263) 2020-03-21 13:08:39 -07:00
Carlos Mendible f36b52107f
Secret Store configuration provider implementation for Microsoft.Extensions.Configuration (#238)
* Implementing Dapr Secret Store configuration provider

* Improved exception message

Co-authored-by: Aman Bhardwaj <amanbha@users.noreply.github.com>
2020-03-18 10:43:19 -07:00
Aman Bhardwaj ae22eb28a5
changing default dapr grpc port (#258) 2020-03-17 19:38:47 -07:00
Aman Bhardwaj 54df7834a7
Using dotnet sdk 3.1.102 2020-03-14 20:21:47 -07:00
Aman Bhardwaj 9f34518c4f
Adding ref. to System.IO.Pipelines explicitly to work around build issue with .netcore sdk 3.1.102 (#250)
* Adding ref. to System.IO.Pipelines explicitly to work around build issue with .netcore sdk 3.1.102

* Adding comment
2020-03-14 10:12:40 -07:00
wanton7 49080d82aa
Throw exception if actor method has more than one parameter when called via http. (#252) 2020-03-13 13:19:03 -07:00
Aman Bhardwaj 49f4dc1582
Updating samples readme 2020-03-13 09:55:45 -07:00
Aman Bhardwaj 2ecb92d746
Updating client sample readme 2020-03-13 09:55:15 -07:00
Aman Bhardwaj fa41389130
Updating list of packages generated 2020-03-13 09:52:56 -07:00
pruthvidhodda f3410b83b4
Fix broken link to DaprClient sample (#248) 2020-03-13 08:31:55 -07:00
Aman Bhardwaj 8979e9f5ac
Updating .netcore version requirement 2020-03-12 16:46:32 -07:00
Aman Bhardwaj a465164702
Updating nuget package minor version to 6 to prepare for next release. 2020-03-11 15:57:29 -07:00
Aman Bhardwaj 204f9c196d
Updating minor version for nuget packages to 5. 2020-03-11 15:54:35 -07:00
Leon Mai 900727f351
#233 Fix DaprError deserialization problems (#247)
* Also removing DaprErrorCodes.cs and using plain strings.  This will
simplify error translation/handling as error codes in the runtime change

* Remove unused using

Co-authored-by: LM <lemai>
2020-03-10 14:12:16 -07:00
Aman Bhardwaj 51fc48fb74
Adding & enhancing client apis over gRPC (#244)
* adding IDAprClient interface

* Adding DaprClientBuilder and adding methods for Publish

* updating the method name for publish

* Adding unit tests for publishevent api

* Removing individual clients for publish

* Renaming base class to DaprClient and implementation calss to DparClientGrpc

* Moving State api to grpc and adding helpers to unittest grpc calls.

* More DaprClient logic

* metadata, etag, options, etc are optional

* Revert "metadata, etag, options, etc are optional"

This reverts commit ea5dc12c5d.

* Default params, 2 new Try- methods, overload refactor for InvokeMethodAsync

* Move some classes/enums to different files.  Documentation

* Code refactor and changing tests to use grpc

* Adding tests with state options

* Adding test for getting etag and state

* More refactoring and adding INvokeBinding test

* Fixing tests and tidying up things.

* Updating solutions for renamed project

* Updating projects for rename.

* Oneclient secret (#245)

* ADding Secret Apis

* Using Task for secret

* Format (#242)

* Updating samples.slm

* awaint the call to grpc in common method so that common error handling can be done there.

* Addressing review comments

* fixing test.sln

* updating prod.sln

* Addressing review comments from James.

* Add doc and example for method invocation on http app

* Updating arg validation.

* Updating example.

Co-authored-by: LM <lemai>
Co-authored-by: Carlos Mendible <cmendible@gmail.com>
2020-03-09 20:52:12 -07:00
Leon Mai 43390dfb0e
Merge pull request #246 from dapr/errorcode
DaprError deserialization
2020-03-09 20:34:46 -07:00
LM f1d38b1bf1 #233 DaprError deserialization 2020-03-09 17:29:46 -07: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