Groovy Documentation

edu.usf.MessageService
[Groovy] Class MessageServiceClient

java.lang.Object
  edu.usf.MessageService.MessageServiceClient

@Slf4j
class MessageServiceClient

Groovy Client for MessageService

Authors:
Eric Pierce (epierce@usf.edu)
Version:
0.6.1


Constructor Summary
MessageServiceClient(java.lang.String messageHost)

@param messageHost URL of the MessageService Host (Example: https://server.example.edu)

 
Method Summary
JSONObject changeMessageStatus(java.lang.String name, java.lang.String id, java.lang.String status)

Change the status on a message in a queue

JSONObject createQueue(java.lang.String name, java.util.List canRead = [], java.util.List canWrite = [], java.util.List canAdmin = [])

Create a new queue

JSONObject createQueueMessage(java.lang.String program, java.lang.String name, java.util.Map data)

Create a new message in a queue

JSONObject createTopic(java.lang.String name, java.util.List canRead = [], java.util.List canWrite = [], java.util.List canAdmin = [])

Create a new topic

JSONObject createTopicMessage(java.lang.String program, java.lang.String name, java.util.Map data)

Create a new message in a topic

java.lang.String deleteQueue(java.lang.String name)

Delete Queue

java.lang.String deleteQueueMessage(java.lang.String name, java.lang.String id)

Delete a message from a queue

java.lang.String deleteTopic(java.lang.String name)

Delete Topic

JSONArray getInProgressMessages(java.lang.String queue)

Get a list of all messages in a queue with the status 'in-progress'

JSONObject getQueueList()

Get a list of all message queues

JSONObject getQueueMessage(java.lang.String queue)

Get oldest "pending" message in a queue

JSONObject getTopicList()

Get a list of all message topics

JSONArray getTopicMessages(java.lang.String topic, java.lang.Object startTime = null , java.lang.Object endTime = null)

Get a list of all messages in a topic

JSONArray peek(java.lang.String queue, java.lang.Integer num = 10)

Get a list of messages in a queue without changing their status

void setCredentials(java.lang.String username, java.lang.String password)

Set the username and password for MessageService access

void setKeyStoreLocation(java.lang.String keyStorePath, java.lang.String keyStorePass)

Set the location and password of the Java Trust Store to use for this connection.

void setMessageBasePath(java.lang.String path)

Set the base location of the MessageService deployment.

void setQueueFileLocation(java.lang.String queueDirectory)

Set the directory to write local queue files to in case of a MessageService outage or error

void trustAllCerts()

Disable certificate validation and trust the certificate of any server we connect to.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

MessageServiceClient

MessageServiceClient(java.lang.String messageHost)
Parameters:
messageHost - URL of the MessageService Host (Example: https://server.example.edu)


 
Method Detail

changeMessageStatus

JSONObject changeMessageStatus(java.lang.String name, java.lang.String id, java.lang.String status)
Change the status on a message in a queue
throws:
Exception
throws:
RuntimeException
Parameters:
name - Queue containing the message
id - Message ID
status - Status to change the message to. (allowed: in-progress, pending, completed, error)
Returns:
JSONObject of the new state of the message


createQueue

JSONObject createQueue(java.lang.String name, java.util.List canRead = [], java.util.List canWrite = [], java.util.List canAdmin = [])
Create a new queue
throws:
Exception
throws:
RuntimeException
Parameters:
name
canRead - List of the user who can read messages from this queue
canWrite - List of the user who can write messages to this queue
canAdmin - List of the user who can modify this queue
Returns:
JSONObject of the queue data


createQueueMessage

JSONObject createQueueMessage(java.lang.String program, java.lang.String name, java.util.Map data)
Create a new message in a queue
throws:
Exception
throws:
RuntimeException
Parameters:
program - Name of the program creating this message
name - Queue to write the message to
data - Data to write to the message
Returns:
JSONObject of the created message


createTopic

JSONObject createTopic(java.lang.String name, java.util.List canRead = [], java.util.List canWrite = [], java.util.List canAdmin = [])
Create a new topic
throws:
Exception
throws:
RuntimeException
Parameters:
name
canRead - List of the user who can read messages from this topic
canWrite - List of the user who can write messages to this topic
canAdmin - List of the user who can modify this topic
Returns:
JSONObject of the topic data


createTopicMessage

JSONObject createTopicMessage(java.lang.String program, java.lang.String name, java.util.Map data)
Create a new message in a topic
throws:
Exception
throws:
RuntimeException
Parameters:
program - Name of the program creating this message
name - Topic to write the message to
data - Data to write to the message
Returns:
JSONObject of the created message


deleteQueue

java.lang.String deleteQueue(java.lang.String name)
Delete Queue
throws:
Exception
throws:
RuntimeException
Parameters:
name
Returns:
Name of the deleted queue


deleteQueueMessage

java.lang.String deleteQueueMessage(java.lang.String name, java.lang.String id)
Delete a message from a queue
throws:
Exception
throws:
RuntimeException
Parameters:
name - Queue containing the message
id - Message ID
Returns:
id of the deleted message


deleteTopic

java.lang.String deleteTopic(java.lang.String name)
Delete Topic
throws:
Exception
throws:
RuntimeException
Parameters:
name
Returns:
Name of the deleted topic


getInProgressMessages

JSONArray getInProgressMessages(java.lang.String queue)
Get a list of all messages in a queue with the status 'in-progress'
Parameters:
queue - Queue to retrive messages from
Returns:
JSONArray containing results from MessageService


getQueueList

JSONObject getQueueList()
Get a list of all message queues
Returns:
JSONObject containing results from MessageService


getQueueMessage

JSONObject getQueueMessage(java.lang.String queue)
Get oldest "pending" message in a queue
Parameters:
queue - Queue to retrive messages from
Returns:
JSONArray containing message from MessageService


getTopicList

JSONObject getTopicList()
Get a list of all message topics
Returns:
JSONObject containing results from MessageService


getTopicMessages

JSONArray getTopicMessages(java.lang.String topic, java.lang.Object startTime = null , java.lang.Object endTime = null)
Get a list of all messages in a topic
Parameters:
topic - Topic to retrive messages from
startTime - Time to start message list at. Format yyyy-MM-dd'T'HH:mm:ss (optional)
endTime - Time to end message list at. Format yyyy-MM-dd'T'HH:mm:ss (optional)
Returns:
JSONArray containing results from MessageService


peek

JSONArray peek(java.lang.String queue, java.lang.Integer num = 10)
Get a list of messages in a queue without changing their status
Parameters:
queue - queue to retrive messages from
num - Number of messages to retrieve (Default: 10)
Returns:
JSONArray containing results from MessageService


setCredentials

void setCredentials(java.lang.String username, java.lang.String password)
Set the username and password for MessageService access
Parameters:
username
password


setKeyStoreLocation

void setKeyStoreLocation(java.lang.String keyStorePath, java.lang.String keyStorePass)
Set the location and password of the Java Trust Store to use for this connection.
throws:
FileNotFoundException
Parameters:
keyStorePath - Java key/trust store
keyStorePass - keystore Password


setMessageBasePath

void setMessageBasePath(java.lang.String path)
Set the base location of the MessageService deployment.
Parameters:
path - MessageService path (Default: /MessageService/basic)


setQueueFileLocation

void setQueueFileLocation(java.lang.String queueDirectory)
Set the directory to write local queue files to in case of a MessageService outage or error
throws:
FileNotFoundException
Parameters:
queueDirectory - Directory to save files in


trustAllCerts

void trustAllCerts()
Disable certificate validation and trust the certificate of any server we connect to. When dealing with lots of servers with self-signed certs (development), it can be helpful to bypass a custom trust store and trust all certs automatically.
Since:
0.6.0


 

Groovy Documentation