Skip to content

Instantly share code, notes, and snippets.

View arkadiuszwojcik's full-sized avatar

Arkadiusz Wójcik arkadiuszwojcik

View GitHub Profile
@arkadiuszwojcik
arkadiuszwojcik / TestActor.cs
Created December 11, 2019 20:47
Test scoped actor
[ActorScope(typeof(ActorScopeInstaller))]
public class TestActor : IActor
{
public Task ReceiveAsync(IContext context)
{
switch (context.Message)
{
case Started _:
var scopeContext = context as ActorScopeContext;
var pid = scopeContext.Spawn<SomeActor>();
@arkadiuszwojcik
arkadiuszwojcik / ActorContainerNext.cs
Created December 11, 2019 20:38
Scoped dependency injection in Proto Actor
public class ActorContainerNext : WindsorContainer
{
private readonly ConcurrentDictionary<Type, PID> singletons = new ConcurrentDictionary<Type, PID>();
public ActorContainerNext(IWindsorContainer parent = null)
{
Parent = parent;
Register(ContainerComponents().ToArray());
}