Hello dear developers!
I use AKKA.NET in my project. There is a need to use mailboxes to set priorities for messages. According to the article https://getakka.net/articles/actors/mailboxes.html, I created a mailbox:

public class MyActorMailBox: UnboundedPriorityMailbox { public MyActorMailBox(Settings settings, Config config) : base(settings, config) {} protected override int PriorityGenerator(object message) { if (message is MyActorMailBox.ErroredMessage) return 0; return 1; } } 

Creating an instance of the actor with mailbox:

  ActorSystem.ActorOf( Props.Create(() => new MyActor()).WithMailbox("myactor-mailbox"), "MyActor"); 

After that, I added the setting in App.config

  <!-- language: lang-xml --> <akka> <hocon> <![CDATA[ akka {...} myactor-mailbox { mailbox-type="MyActorMailBox, MyAssembly" } ]]> </hocon> </akka> 

I get System.Threading.SynchronizationLockException: Object synchronization method. I guess this is due to the unsynchronized message queue in the default mailbox. The following call stack does not contain information about the type of message:

 Swallowing exception during message send System.Threading.SynchronizationLockException: Object synchronization method was called from an unsynchronized block of code. at Akka.Dispatch.MessageQueues.BlockingMessageQueue.Enqueue(IActorRef receiver, Envelope envelope) at Akka.Dispatch.MessageDispatcher.Dispatch(ActorCell cell, Envelope envelope) at Akka.Actor.ActorCell.SendMessage(Envelope message) 

Does anyone have any ideas?
thank

  • In Russian stackoverflow it is customary to ask questions in Russian, please translate. - Sergey Glazirin
  • I use AKKA.NET and I need to add mailboxes to set the priority of messages according to the article: getakka.net/articles/actors/mailboxes.html I assume that this is due to the message queue of the mailbox that is unsynchronized. The call stack does not contain details about the type of received message that causes the problem - Sergey Filippov
  • Click the "edit" button in question and translate the text of the questions so that the question conforms to the rules of the site. - Sergey Glazirin

0