Class RestWorkersPlugin
- java.lang.Object
-
- io.vertigo.stella.plugins.work.rest.workers.RestWorkersPlugin
-
- All Implemented Interfaces:
io.vertigo.core.node.component.CoreComponent
,io.vertigo.core.node.component.Plugin
,WorkersPlugin
public final class RestWorkersPlugin extends Object implements WorkersPlugin
Implémentation de DistributedWorkManager, pour l'execution de travaux par des Workers distant. Cette implémentation représente la partie client qui se déploie en ferme. 1- contacte la partie serveur pour récupérer les travaux qu'elle sait gérer, 2- execute la tache en synchrone exclusivement 3- retourne le résultat au serveur- Author:
- npiedeloup, pchretien
-
-
Constructor Summary
Constructors Constructor Description RestWorkersPlugin(String serverUrl, int timeoutSeconds, CodecManager codecManager)
Constructeur.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <WR,W>
WorkItem<WR,W>pollWorkItem(String nodeId, String workType)
Polling workitem.<R> void
putResult(String workId, R result, Throwable error)
Send result or error if execution failedvoid
putStart(String workId)
-
-
-
Constructor Detail
-
RestWorkersPlugin
@Inject public RestWorkersPlugin(String serverUrl, int timeoutSeconds, CodecManager codecManager)
Constructeur.- Parameters:
serverUrl
- Url du serveurtimeoutSeconds
- Timeout en seconde des connections vers le serveur (doit être > au timeoutSeconds du serveur)codecManager
- Manager d'encodage/decodage
-
-
Method Detail
-
pollWorkItem
public <WR,W> WorkItem<WR,W> pollWorkItem(String nodeId, String workType)
Polling workitem.- Specified by:
pollWorkItem
in interfaceWorkersPlugin
- Type Parameters:
WR
- resultW
- workworkType
- Type de tache- Returns:
- Workitem or null (if timeout)
-
putResult
public <R> void putResult(String workId, R result, Throwable error)
Send result or error if execution failed- Specified by:
putResult
in interfaceWorkersPlugin
- Type Parameters:
R
- result- Parameters:
workId
- WorkIdresult
- Result (not null if execution succeeded)error
- Error ( not null if execution failed)
-
putStart
public void putStart(String workId)
- Specified by:
putStart
in interfaceWorkersPlugin
-
-