Custom protocol: How do you handle Futures in an Action ?

Hi everyone,

I’m trying to write a custom protocol to test the performance of this library: https://simplesource.io/

The API of this lib I want to bench as the following interface:

trait CommandAPI [K, C] {

  def publishCommand(request: Request[K, C]): Future[Either[CommandError, CommandId]]

  def queryCommandResult(commandId: CommandId, timeout: Duration): Future[Either[CommandError, Sequence]]

  def publishAndQueryCommand(commandRequest: Request[K, C], timeout: Duration): Future[Either[CommandError, Sequence]]

}

But the Action#execute should return a Unit:

trait Action extends StrictLogging {

  def name: String

  def !(session: Session): Unit = execute(session)

  /**
   * Core method executed when the Action received a Session message