Skip to content

Commit

Permalink
Merge pull request #3 from man-group/sxj
Browse files Browse the repository at this point in the history
Update to Dapr 1.2.0, remove Placement from sample
  • Loading branch information
a-elsheikh authored May 28, 2021
2 parents 329cb34 + 2747b23 commit bc326c0
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 51 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ Original concept and implementation: [Simon Jones](https://github.com/badgeratu)

Contributors:

* ... be the first! ...
* [Abdulaziz Elsheikh](https://github.com/a-elsheikh)

Contributions welcome!
Contributions welcome! Please review the [Contribution Guidelines](CONTRIBUTING.md).

## License

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapr.Actors" Version="1.2.0-rc01" />
<PackageReference Include="Dapr.Actors" Version="1.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapr.Actors" Version="1.2.0-rc01" />
<PackageReference Include="Dapr.Actors.AspNetCore" Version="1.2.0-rc01" />
<PackageReference Include="Dapr.Actors" Version="1.2.0" />
<PackageReference Include="Dapr.Actors.AspNetCore" Version="1.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/Actor/ActorSample/ActorSample.DemoActor/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void ConfigureServices(IServiceCollection services)
});

// Add Dapr Sidekick
services.AddDaprSidekick(Configuration).AddPlacement();
services.AddDaprSidekick(Configuration);
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapr.Actors" Version="1.2.0-rc01" />
<PackageReference Include="Dapr.Actors" Version="1.2.0" />
</ItemGroup>

</Project>
39 changes: 4 additions & 35 deletions samples/Actor/ActorSample/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Actor Sample

The Actor sample shows how to create a virtual actor (`DemoActor`) and invoke its methods on the client application. The sample is a copy of the [Dapr .NET SDK Actor Sample](https://github.com/dapr/dotnet-sdk/tree/master/examples/Actor), but modified to include Dapr Sidekick integration for launching a Dapr sidecar and optionally the Dapr Placement service.
The Actor sample shows how to create a virtual actor (`DemoActor`) and invoke its methods on the client application. The sample is a copy of the [Dapr .NET SDK Actor Sample](https://github.com/dapr/dotnet-sdk/tree/master/examples/Actor), but modified to include Dapr Sidekick integration for launching a Dapr sidecar.

> See the [original source](https://github.com/dapr/dotnet-sdk/tree/master/examples/Actor) for more information on the purpose of the sample.
Expand All @@ -12,48 +12,17 @@ The main change to the template code to add Dapr support can be found in the `Co
public void ConfigureServices(IServiceCollection services)
{
...
// Add Dapr Sidekick with both Sidecar and Placement support
services.AddDaprSidekick(Configuration)
.AddPlacement();
// Add Dapr Sidekick
services.AddDaprSidekick(Configuration);
}
```

The following section has also been added in `appsettings.json` in the same project:

```json
{
"Dapr": {
"Placement": {
"Enabled": false,
"Port": 6060
}
}
}
```

> This configuration will initially disable the Placement service support in Dapr Sidekick, we'll come back to this shortly.
## Running the example

This sample requires a full initialized Dapr installation with both the `dapr_placement` and `dapr_redis` containers up and running. If this is not the case please follow the instructions to [Init Dapr Locally](https://docs.dapr.io/getting-started/install-dapr-selfhost/).

Build the solution and set the `ActorSample.DemoActor` project as the startup, then run it in Visual Studio. The Dapr Sidecar will launch and the hosted actor will use it to registered with the placement service.

> By default Dapr will search for the Placement service on port 6050 on Windows, or 50005 on other platforms. This is the port exposed by the `dapr_placement` container on Windows.
> By default Dapr will search for the Placement service on port 6050 on Windows, or 50005 on other platforms. This is the port exposed by the `dapr_placement` container.
Navigate to the ActorClient build output directory at `<RepoRoot>/bin/<Debug|Release>/samples/ActorSample.ActorClient/netcoreapp3.1` and run `ActorSample.ActorClient.exe`. This will connect to the same Dapr sidecar on port 3500 and submit calls to the hosted Actor.

Stop the running solution in Visual Studio, then change the `Dapr:Placement:Enabled` property in `appsettings.json` from `false` to `true`:

```json
{
"Dapr": {
"Placement": {
"Enabled": true, // <-- Change this from false to true
"Port": 6060
}
}
}
```

Run the solution in Visual Studio again - this time the Placement service will come up first (pay close attention to the log messages!) on port 6060, followed by the Sidecar which will automatically connect to that port instead of the default container instance. Run the `ActorSample.ActorClient.exe` application again and this time you will see additional logging occuring in the `ActorSample.DemoActor` console output window showing the locally-hosted Placement service handling the requests.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapr.AspNetCore" Version="1.2.0-rc01" />
<PackageReference Include="Dapr.AspNetCore" Version="1.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
</ItemGroup>

Expand Down

0 comments on commit bc326c0

Please sign in to comment.