2016-04-13 3 views
15

ho creato un servizio di stateful con l'out-of-the-box di partizionamento:L'istanza primaria o senza stato per la partizione ha indirizzo non valido

<StatefulService ServiceTypeName="ExamplesServiceType" TargetReplicaSetSize="[ExamplesService_TargetReplicaSetSize]" MinReplicaSetSize="[ExamplesService_MinReplicaSetSize]"> 
      <UniformInt64Partition PartitionCount="[ExamplesService_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" /> 
     </StatefulService> 

Il manifesto di servizio imposta i params per (out-of-the -Box pure):

<Parameter Name="ExampleService_PartitionCount" Value="1" /> 
<Parameter Name="ExampleService_MinReplicaSetSize" Value="2" /> 
<Parameter Name="ExampleService_TargetReplicaSetSize" Value="3" /> 
<Parameter Name="WebService_InstanceCount" Value="1" /> 

Ora voglio chiamare a al mio servizio stateful da mio servizio senza stato nello stesso cluster:

ServiceUriBuilder builder = new ServiceUriBuilder(ExampleServiceName); 
var service = ServiceProxy.Create<IExampleService>(builder.ToUri(),new ServicePartitionKey(1)); 

return service.MyCallAsync(id); 

Sto ottenendo il seguente errore:

The primary or stateless instance for the partition 'a67f7afa-3370-4e6f-ae7c-15188004bfa1' has invalid address, this means that right address from the replica/instance is not registered in the system

Il servizio stateful che sto cercando di raggiungere i registri per i registri eventi ei registri portano "PartitionID": "a67f7afa-3370-4e6f-ae7c-15188004bfa1".

Cosa mi manca?

risposta

19

non stavo registrando un telecomando come spiegato a http://vunvulearadu.blogspot.com/2016/04/azure-service-fabric-primary-or.html

 protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners() 
    { 
     return new[] { new ServiceReplicaListener(context => this.CreateServiceRemotingListener(context)) }; 
    } 
+0

Grazie mille per condividere la tua soluzione, questo ha risolto il mio mal di testa. ;) –

+3

CreateServiceRemotingListener è un metodo di estensione in questo spazio dei nomi, quindi assicurati di aggiungerne uno utilizzando Microsoft.ServiceFabric.Services.Remoting.Runtime; per coloro che non riescono a trovare il metodo di estensione. – SondreB

+0

@mayu: sto affrontando lo stesso problema, ma sto chiamando un servizio stateless all'interno dell'applicazione actor e non ho il metodo CreateServiceReplicaListeners() da sovrascrivere, qualche idea su come questo deve essere fatto per gli attori? – Vinodh

10

Nel caso in cui nessuno viene qui chiedendo cosa fare per i servizi senza stato, questo funziona per me:

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