Aggregate Root - Saga - Synchronous Command

Having an aggregate root User modeled as NServiceBus Saga

User.cs

public class User {
   ....
   public string Rename(string name) {
     .// some validation logic
   }
   ...
}

UserSagaData.cs

public class UserSagaData : ContainSagaData
{
  public User User { get; set;}
}

UserSaga.cs

public partial class UserSaga : Saga<RenameUser>
{
   ...
   public async Task Handle(RenameUserimportAttendees, IMessageHandlerContext context)
  {
     Data.User.rename(...
  } 
   ...
}

Now i have a requirement to accept RenameUser command via REST API and give the feedback in HTTP Response, hence sending RegisterUser to message broker from Controller.Action is not an option. I need to perform command synchronously, get feedback and send http response.

First thing that came to mind is to use ISagaPersister, that is, retrieve saga by id, then invoke a command and then persist saga back to the datastore with ISagaPersister (which takes care of optimistic locking). Any thoughts on that ?

Is there alternative solutions to this problem ?

What type of feedback would you expect the RenameUser command to result in?

Can’t you just return a HTTP OK and queue up the rename command? (assuming that you have validation of the new name in place the chances of something going wrong should be slim and could be dealt with offline should the command end up in the error queue?)

An option if you really have to wait for the response is to use our callbacks package, Client-side callbacks • Callbacks • Particular Docs, to enable your REST API block until the response has arrived, this way you can still using messaging behind the scenes.

What do you think?

Cheers,

Andreas