code: public static <T> Publisher<T> then(Publisher<T> publisher, Consumer<T> consumer) {
          return actual -> publisher.subscribe(new CompletionAwareSubscriber<T>() {
              @Override
              protected void doOnSubscribe(Subscription subscription) {
                  actual.onSubscribe(subscription);
              }
  
              @Override
              protected void doOnNext(T message) {
                  try {
                      actual.onNext(message);
                      consumer.accept(message);
                  } catch (Throwable e) {
                      onError(e);
                  }
              }
  
              @Override
              protected void doOnError(Throwable t) {
                  actual.onError(t);
              }
  
              @Override
              protected void doOnComplete() {
                  actual.onComplete();
              }
          });
      }
docs: Map the result from a publisher using the given mapper.
  
  @param publisher The publisher
  @param consumer  The mapper
  @param <T>       The generic type
  @return The mapped publisher