-
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* allow configure of system props * fix log messages
- Loading branch information
1 parent
476b08d
commit ebf1afa
Showing
15 changed files
with
235 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file = "SystemContext.cs" company = "Asynkron AB"> | ||
// Copyright (C) 2015-2022 Asynkron AB All rights reserved | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
using System; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Proto; | ||
|
||
public static class SystemContext | ||
{ | ||
private static readonly ILogger Logger = Log.CreateLogger(nameof(SystemContext)); | ||
|
||
public static PID SpawnNamedSystem(this RootContext self, Props props, string name) | ||
{ | ||
try | ||
{ | ||
var parent = props.GuardianStrategy is not null | ||
? self.System.Guardians.GetGuardianPid(props.GuardianStrategy) | ||
: null; | ||
|
||
//augment props with system actor specific settings | ||
props = self.System.ConfigureSystemProps(name, props); | ||
return props.Spawn(self.System, name, parent); | ||
} | ||
catch (Exception x) | ||
{ | ||
Logger.LogError(x, "SystemContext Failed to spawn system actor {Name}", name); | ||
throw; | ||
} | ||
} | ||
} |
Oops, something went wrong.