'Akka.DependencyInjection doesn't throw error when can't resolve dependencies

I'm using the DI in the following way:

 _actorSystem.ActorOf(
    Supervise(PropsWithDI<MessagePublisherActor>()), MessagePublisher.ActorName);

private Props PropsWithDI<T>(params object[] args) where T : ActorBase
    => DependencyResolver.For(_actorSystem).Props<T>(args);

If somehow there is a Constructor parameter which isn't added to the DI container, it simply doesn't create the Actor, which is normal of course but I would expect an error or something.

Am I using it wrong or is this a missing functionality of Akka.NET Akka.DependencyInjection.



Solution 1:[1]

After reviewing the code I've found that this is actually a design choice.

The ActorSystem is designed with fault isolation in mind, it is designed so that any fault happening on the individual actor level would not propagate up to the application layer and crash the application, just like in any operating system, you don't want a fault in a single process to bring the whole operating system down.

To achieve this, actors are started asynchronously inside their own bubble to create a high degree of fault isolation. It is actually done in 2 steps:

  1. An empty actor holder is returned by the ActorOf() method, this holder contains the MailBox and ActorCell. ActorCell contains the Props needed by the system to re/create the actor as needed.
  2. A Create system message is enqueued into the Mailbox, triggering the actual Actor instantiation.

This is essentially a "bubble" where the actor code lives, any exception thrown by any code at step 2 onward are blocked from propagating to the application layer and instead propagated up the chain of actors above it, letting them decide on what would happen to the faulting actors. Since the DI exception happened on step 2 of the process, the exception would never reach the code that actually calls the ActorOf() method and instead be propagated up to the guardian actor and be logged as an error in the log.

Solution 2:[2]

Sounds what you wanted can be achieve using 2 EXISTS conditions

SELECT *
FROM   tbl
WHERE  NOT EXISTS  -- ALL Service items are completed 
       (
           SELECT *
           FROM   tbl 
           WHERE  Category = 'SERVICE'
           AND    Status   <> 'COMPLETED'
       )
AND    EXISTS      -- there are Upgrade items that are not completed
       (
           SELECT *
           FROM   tbl 
           WHERE  Category = 'UPGRADE'
           AND    Status   <> 'COMPLETED'
       )

Solution 3:[3]

You can go for simple query, as given below:

SELECT [Item ID], [Status],[Category]
FROM TableName
WHERE Status = 'COMPLETED' AND Category = 'SERVICE'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Greg
Solution 2 Squirrel
Solution 3 Venkataraman R