Show Table of Contents
32.4. Running Remote Tasks
If authorization is disabled on the server then anyone may execute remote tasks once they have been installed. Otherwise, only users with
EXEC permissions will be allowed to run previously installed tasks. If a remote task has additional users specified, via the getAllowedRole method, then users must also belong to this role to execute the script.
To execute a previously deployed task call
execute(String taskName, Map parameters) on the desired cache. The following example demonstrates executing a task with the name sampleTask:
import org.infinispan.client.hotrod.*;
import java.util.*;
[...]
String TASK_NAME = "sampleTask";
RemoteCacheManager rcm = new RemoteCacheManager();
RemoteCache remoteCache = rcm.getCache();
// Assume the task takes a single parameter, and will return a result
Map<String, String> params = new HashMap<>();
params.put("name", "value");
String result = (String) remoteCache.execute(TASK_NAME, params);
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.