0

Hi I just started learning reactive programming

I have this piece of code here and my process here should be I will call tokenRepository to get the token and then, use the token.getAccessToken() to be used as a parameter on the cardRepository.findAllCards()

public class CardService {

    private final CardRepository cardRepository;
    private final TokenRepository tokenRepository;

    public CardService(CardRepositorycardRepository,
                       TokenRepository tokenRepository) {
        this.cardRepository = cardRepository;
        this.tokenRepository = tokenRepository;
    }

    public Mono<CardCollection> findAllCards(MultiValueMap<String, String> queryParams) {
        Mono<Token> token =tokenRepository.requestToken(); 

        // then I would like to use the token.getAccessToken
        return cardRepository.findAllCards(token.getAccessToken, queryParams); // Then this should return Mono<CardCollection>
    }
}

Would like to know if this is possible?

4

1 に答える 1