code: public Completable recoverState(final StateFormat format, final byte[] persistedState) {
      return Completable.create(new Completable.OnSubscribe() {
        @Override
        public void call(CompletableSubscriber subscriber) {
          LOGGER.info("Recovering state from format {}", format);
          LOGGER.debug("PersistedState on recovery is: {}", new String(persistedState, CharsetUtil.UTF_8));
  
          try {
            if (format == StateFormat.JSON) {
              sessionState().setFromJson(persistedState);
              subscriber.onCompleted();
            } else {
              subscriber.onError(new IllegalStateException("Unsupported StateFormat " + format));
            }
          } catch (Exception ex) {
            subscriber.onError(ex);
          }
        }
      });
    }
docs: Initializes the {@link SessionState} from a previous snapshot with specific state information.
  <p>
  If a system needs to be built that withstands outages and needs to resume where left off, this method,
  combined with the periodic persistence of the {@link SessionState} provides resume capabilities. If you
  need to start fresh, take a look at {@link #initializeState(StreamFrom, StreamTo)} as well as
  {@link #recoverOrInitializeState(StateFormat, byte[], StreamFrom, StreamTo)}.
  
  @param format the format used when persisting.
  @param persistedState the opaque byte array representing the persisted state.
  @return A {@link Completable} indicating the success or failure of the state recovery.