I've got a very simple implementation using Akka.NET remoting.
Specifically I have two actors:
public class ClientQueryActor : ReceiveActor
{
public ClientQueryActor(ActorSelection stockBarcodeActor)
{
this._stockBarcodeActor = stockBarcodeActor ?? throw new ArgumentNullException("stockBarcodeActor must be provided.");
this.Receive<GetStockBarcodeByBarcodeRequest>(this.HandleStockBarcodeByBarcodeRequestReceived);
this.Receive<GetStockBarcodeByBarcodeResponse>(this.HandleStockBarcodeByBarcodeResponseReceived);
}
private void HandleStockBarcodeByBarcodeRequestReceived(GetStockBarcodeByBarcodeRequest obj)
{
this._stockBarcodeActor.Tell(obj);
}
private void HandleStockBarcodeByBarcodeResponseReceived(GetStockBarcodeByBarcodeResponse obj)
{
}
}
public class StockBarcodeQueryActor : ReceiveActor
{
public StockBarcodeQueryActor()
{
this.Receive<GetStockBarcodeByBarcodeRequest>(this.HandleStockBarcodeByBarcodeRequestReceived);
}
private void HandleStockBarcodeByBarcodeRequestReceived(GetStockBarcodeByBarcodeRequest obj)
{
this.Sender.Tell(new GetStockBarcodeByBarcodeResponse(true, null, null));
}
}
For the most part these actors seem to be working properly the issue is in the messages I am sending.
My message class looks roughly like this:
public class GetStockBarcodeByBarcodeResponse
{
public GetStockBarcodeByBarcodeResponse(bool success) { }
public GetStockBarcodeByBarcodeResponse(bool success, IEnumerable<string> errors) { }
}
However when I attempt to send a message using this class I get the error
'Association with remote system akka.tcp://client@localhost:2552 has failed; address is now gated for 5000 ms. Reason is: [Akka.Remote.EndpointDisassociatedException: Disassociated'
When I remove the multiple constructors the message sends successfully.
I have been unable to find anything in the documentation referencing this problem, can someone please explain this limitation to me?
Could anyone provide any suggested workarounds?
GetStockBarcodeByBarcodeResponse
with other constructors. Serializers expects a default constructor. – vendettamit