Skip to content

Instantly share code, notes, and snippets.

@germanviscuso
Created June 27, 2019 10:22
Show Gist options
  • Save germanviscuso/e4231ab43359cdbc50c8462314aba450 to your computer and use it in GitHub Desktop.
Save germanviscuso/e4231ab43359cdbc50c8462314aba450 to your computer and use it in GitHub Desktop.
Progressive Response in Java
sendProgressiveResponseMessage("Please wait!", handlerInput);
public static void sendProgressiveResponseMessage(final String message,
final HandlerInput handlerInput){
final SpeakDirective speakDirective = SpeakDirective.builder()
.withSpeech(message)
.build();
final String requestId = handlerInput.getRequestEnvelope().getRequest().getRequestId();
final SendDirectiveRequest sendDirectiveRequest = SendDirectiveRequest.builder()
.withDirective(speakDirective)
.withHeader(Header.builder().withRequestId(requestId).build())
.build();
handlerInput.getServiceClientFactory().getDirectiveService().enqueue(sendDirectiveRequest);
}
}
@germanviscuso
Copy link
Author

Nice!! Yes, it's basically the same. Let me know if you manage to "await" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment