I am trying to get information about a thread in the questions thread. I want the title and first message. The title is easy enough. The first message for the thread is proving harder.
Here is a couple of my attempts:
String questionFirstMessage = threadChannel.retrieveParentMessage()
.complete().getContentDisplay();
String questionFirstMessage = threadChannel.getHistoryFromBeginning(1) .complete().getRetrievedHistory().get(0).getContentDisplay();
But it seems that using complete() implicitly or explicitly isn't allowed. It appears that I have to use queue() and pass it along to another method, like this:
threadChannel.getHistoryFromBeginning(1).queue(messageHistory -> {
methodToCompleteTask(messageHistory.getRetrievedHistory().get(0).getContentDisplay());
});
So my question is: Is there a nice way to get the String I want, like in the first two examples that doesn't use queue? Am I over complicating this?