1
votes

We are running a few Stateless Reliable Services and are having performance issues with service-to-service communication using the reverse proxy (http://localhost:19081/{app}/{svc}/bleh). Without getting into the details there, we are looking into using remoting as described here: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting

However, I am having a hard time figuring out how I would expose the API methods in the service type class, as they currently exist in our controllers. The controllers, via dependency injection, get the repository instances needed, etc..., so I'm spinning my wheels on how to get this accomplished without some sort of redundant instances or circular dependency.

I'm sitting here staring at this on "PersonService.cs":

internal sealed class PersonService: StatelessService, IPersonService
{
        public PersonService(StatelessServiceContext context)
            : base(context)
        { }

        ...
        public PersonResponse GetPersonFromDb()
        {
          //lost here :(
        }

Where my controller, which works fine, has:

public PersonController(IPersonRepository personRepository)
{
  _personRepository = personRepository;
}
   ...
public IActionResult GetPerson()
{
    var personResponse = _dbRepository.GetPerson();
    return new ObjectResult(personResponse);
}

D:

1

1 Answers

0
votes

Can't you pass the repository to your service, similar to this?

public PersonService(StatelessServiceContext context, IPersonRepository personRepository)
            : base(context)
{
   _personRepository = personRepository;
}

public PersonResponse GetPersonFromDb()
{
    var personResponse = _personRepository.GetPerson();
    return personResponse;
}