3

I have a Windows Service with an Akka.NET Actor System. In one actor I use an external .NET component (HAL | Facade Pattern) that uses an event-based design to listen devices cross network, I create the instance of the component on the actor and register the events that the component requires. I use the Ninject dependency injection to get the instance of the component. How can I get callback of this component? I mean I need to receive events of this component in my actor.

One option is create an additional thread in the actor to listen those events and send it to the actor with a regular message (Tell) but I don´t know if is the best way or exists another one.

gemr1423
  • 739
  • 2
  • 11
  • 33
  • 1
    Sorry, but you didn't provided any actual information. Code snippet also doesn't explain anything. Where/how are you registering the events? How are you sending messages to your actors? Are you using remote actors or is this a local thing only? – Bartosz Sypytkowski Jan 30 '19 at 07:07
  • @BartoszSypytkowski I register the event on when I assign "MyMethod" to the event/delegate "SomeMethod ". I´m not sending messages to this especific actor, because I'm waiting for the execution of the Dispatcher.Invoke. All this is because I alredy have an actor system with the "normal" process, I mean sending and receiving messages, but I need another actor with "different" behavior using a component (DLL) to get messages from a device. – gemr1423 Jan 30 '19 at 16:08
  • @BartoszSypytkowski I tried with PinnedDispatcher but still not working. I think that the problem is with the actors (threads) that are not always active. I need an actor to receive callback of an external component, maybe the actor need to be active all the time, but this callback is not coming as a regular message of an actor. – gemr1423 Jan 31 '19 at 20:54

0 Answers0