class DaprStateAsyncProvider {

  <T> Mono<T> load(String actorType, ActorId actorId, String stateName, TypeRef<T> type) {
    Mono<byte[]> result = this.daprClient.getActorState(actorType, actorId.toString(), stateName);

    return result.flatMap(s -> {
      try {
        T response = this.stateSerializer.deserialize(s, type);
        if (response == null) {
          return Mono.empty();
        }

        return Mono.just(response);
      } catch (IOException e) {
        return Mono.error(new RuntimeException(e));
      }
    });
  }

    DaprStateAsyncProvider(DaprClient daprClient, DaprObjectSerializer stateSerializer);

}