public class Client extends Object
| Constructor and Description |
|---|
Client()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClient(String clientName,
String clientAddress)
Adds a connection to a server, assigning a name to that connection.
|
ClientConnection |
getClientConnection(String clientName)
Retrieves the underlying
ClientConnection, which is the communication layer to the endpoint. |
void |
listJobs(String clientName)
Requests a list of jobs from the specified server.
|
void |
listJobs(String clientName,
String jobType) |
void |
onConnect(Consumer<String> function)
Lambda function called when a connection is successful.
|
void |
onDisconnect(Consumer<String> function)
Lambda function called when a connection is lost, or dropped.
|
void |
onMessage(BiConsumer<String,net.scattersphere.data.message.JobMessage> function)
Lambda function called when a message is received from a server.
|
void |
send(String clientName,
net.scattersphere.data.message.JobMessage message)
Sends a message to the specified server.
|
void |
startJob(String clientName,
String jobName,
String[] arguments)
Starts a job by name, with specified arguments.
|
void |
statusJob(String clientName,
String jobId)
Retrieves status for a job by ID.
|
void |
stopJob(String clientName,
String jobId,
String reason)
Stops a job by its ID.
|
public void addClient(String clientName, String clientAddress)
clientName - The name of the connection to assign.clientAddress - The address to connect to.public ClientConnection getClientConnection(String clientName)
ClientConnection, which is the communication layer to the endpoint. This is available
for use if required.clientName - The name of the connection to retrieve.ClientConnection if found.public void listJobs(String clientName)
clientName - The server to request jobs from.public void startJob(String clientName, String jobName, String[] arguments)
clientName - The server to start a job on.jobName - The name of the job to start.arguments - The arguments to send to the job.public void stopJob(String clientName, String jobId, String reason)
clientName - The server to stop a job on.jobId - The ID of the job to stop.public void statusJob(String clientName, String jobId)
clientName - The server to get a job status from.jobId - The ID of the job to retrieve status for.public void onConnect(Consumer<String> function)
function - The Consumer function to set.public void onDisconnect(Consumer<String> function)
function - The Consumer function to set.public void onMessage(BiConsumer<String,net.scattersphere.data.message.JobMessage> function)
function - The BiConsumer function to set.public void send(String clientName, net.scattersphere.data.message.JobMessage message)
clientName - The server to send a message to.message - The message to send.Copyright © 2015. All rights reserved.