0

I'm calling a stateless service in the actor using the below code:

to solve this we must add the listeners, The primary or stateless instance for the partition has invalid address

But this method (CreateServiceReplicaListeners)vis not available in to override from Actor to register the remote.

How must this be done when we want to make a remote call from actor to service ?

Vinodh
  • 385
  • 1
  • 4
  • 15

1 Answers1

1

1.Add this to your Stateless Service code, liked described here:

protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
    return new[] { new ServiceInstanceListener(context => 
        this.CreateServiceRemotingListener(context)) };
}

2.In your Actor, call the service like this:

var carUpdate = ServiceProxy.Create<ICarUpdate>(new Uri("fabric:/App/Car"));
await carUpdate.ProcessCarUpdate();
LoekD
  • 11,402
  • 17
  • 27
  • this worked. I'm facing another issue now, I'm passing an delegate inside the ProcessCarUpdate(delegate) and this exception is being thrown "Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract name 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' is not expected. Consider using a DataContractResolver if you are using DataContractSerializer or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to the serializer." – Vinodh Dec 13 '16 at 15:58
  • Your datacontracts must be DataContractSerializable. https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-actors-notes-on-actor-type-serialization https://msdn.microsoft.com/library/ms731923.aspx – LoekD Dec 13 '16 at 16:51