OpenSearch/docs/en/watcher/java/service.asciidoc

26 lines
935 B
Plaintext
Raw Normal View History

[float]
[[api-java-service]]
=== Service API
The {watcher} `service` API allows the control the lifecycle of the {watcher}
service. The following example starts the watcher service:
[source,java]
--------------------------------------------------
WatcherServiceResponse watcherServiceResponse = watcherClient.prepareWatchService().start().get();
--------------------------------------------------
The following example stops the watcher service:
[source,java]
--------------------------------------------------
WatcherServiceResponse watcherServiceResponse = watcherClient.prepareWatchService().stop().get();
--------------------------------------------------
The following example restarts the watcher service:
[source,java]
--------------------------------------------------
WatcherServiceResponse watcherServiceResponse = watcherClient.prepareWatchService().restart().get();
--------------------------------------------------