activate-watch.asciidoc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --
  2. :api: activate-watch
  3. :request: ActivateWatchRequest
  4. :response: ActivateWatchResponse
  5. --
  6. [id="{upid}-{api}"]
  7. === Activate Watch API
  8. [id="{upid}-{api}-request"]
  9. ==== Execution
  10. A watch can be activated as follows:
  11. ["source","java",subs="attributes,callouts,macros"]
  12. --------------------------------------------------
  13. include-tagged::{doc-tests-file}[{api}-request]
  14. --------------------------------------------------
  15. [id="{upid}-{api}-response"]
  16. ==== Response
  17. The returned +{response}+ contains the new status of the activated watch.
  18. ["source","java",subs="attributes,callouts,macros"]
  19. --------------------------------------------------
  20. include-tagged::{doc-tests-file}[{api}-response]
  21. --------------------------------------------------
  22. <1> `watchStatus` contains status of the watch
  23. [id="{upid}-{api}-request-async"]
  24. ==== Asynchronous Execution
  25. This request can be executed asynchronously:
  26. ["source","java",subs="attributes,callouts,macros"]
  27. --------------------------------------------------
  28. include-tagged::{doc-tests-file}[{api}-request-async]
  29. --------------------------------------------------
  30. <1> The +{request}+ to execute and the `ActionListener` to use when
  31. the execution completes
  32. The asynchronous method does not block and returns immediately. Once it is
  33. completed the `ActionListener` is called back using the `onResponse` method
  34. if the execution successfully completed or using the `onFailure` method if
  35. it failed.
  36. A typical listener for +{response}+ looks like:
  37. ["source","java",subs="attributes,callouts,macros"]
  38. --------------------------------------------------
  39. include-tagged::{doc-tests-file}[{api}-request-listener]
  40. --------------------------------------------------
  41. <1> Called when the execution is successfully completed. The response is
  42. provided as an argument
  43. <2> Called in case of failure. The raised exception is provided as an argument