2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2017-03-28 17:23:01 -04:00
|
|
|
[[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();
|
|
|
|
--------------------------------------------------
|