public class DefaultAmazonSQSManager extends Object implements AmazonSQSManager
Constructor and Description |
---|
DefaultAmazonSQSManager(AmazonSQSConfig sqsConfig) |
Modifier and Type | Method and Description |
---|---|
String |
getRpcReplyQueueNameAndCreateIfNecessary(String moduleId,
String location)
Retrieve the queue name to use for RPC replies from a
specific RPC Module and location.
|
String |
getRpcRequestQueueNameAndCreateIfNecessary(String moduleId,
String location)
Retrieve the queue name to use for RPC request targetting
a specific RPC Module and location.
|
protected String |
getSinkQueueName(String moduleId) |
String |
getSinkQueueUrlAndCreateIfNecessary(String moduleId)
Retrieve the queue URL for the given Sink Module
and create the queue if it does not already exist.
|
com.amazonaws.services.sqs.AmazonSQS |
getSQSClient()
Retrieve the underlying SQS client.
|
com.amazon.sqs.javamessaging.SQSConnectionFactory |
getSQSConnectionFactory()
Retrieve a connection factory that wraps the
SQS client as a JMS provider.
|
String |
sendMessage(String queueUrl,
String body)
Send message.
|
public DefaultAmazonSQSManager(AmazonSQSConfig sqsConfig)
public String getSinkQueueUrlAndCreateIfNecessary(String moduleId) throws InterruptedException
AmazonSQSManager
This is a blocking operation. If AWS is unreachable, the method will keep retrying indefinitely until the queue is created and the queue URL is determined, or the thread is interrupted.
This function may cache the queue URL, avoiding unecesssary API calls.
getSinkQueueUrlAndCreateIfNecessary
in interface AmazonSQSManager
moduleId
- the ID of the Sink ModuleInterruptedException
public String getRpcRequestQueueNameAndCreateIfNecessary(String moduleId, String location) throws AmazonSQSQueueException
AmazonSQSManager
This function may cache the queue URL, avoiding unecesssary API calls.
getRpcRequestQueueNameAndCreateIfNecessary
in interface AmazonSQSManager
moduleId
- the ID of the RPC Modulelocation
- the targetted location of the requestAmazonSQSQueueException
- if some error occured creating the queue or determining the URLpublic String getRpcReplyQueueNameAndCreateIfNecessary(String moduleId, String location) throws AmazonSQSQueueException
AmazonSQSManager
This function may cache the queue URL, avoiding unecesssary API calls.
getRpcReplyQueueNameAndCreateIfNecessary
in interface AmazonSQSManager
moduleId
- the ID of the RPC Modulelocation
- the source location of the replyAmazonSQSQueueException
- if some error occured creating the queue or determining the URLpublic com.amazonaws.services.sqs.AmazonSQS getSQSClient()
AmazonSQSManager
getSQSClient
in interface AmazonSQSManager
public com.amazon.sqs.javamessaging.SQSConnectionFactory getSQSConnectionFactory()
AmazonSQSManager
getSQSConnectionFactory
in interface AmazonSQSManager
public String sendMessage(String queueUrl, String body) throws InterruptedException
AmazonSQSManager
This is a blocking operation. If AWS is unreachable, the method will keep retrying indefinitely until the message is delivered or the thread is interrupted.
sendMessage
in interface AmazonSQSManager
queueUrl
- the queue URLbody
- the message bodyInterruptedException
Copyright © 2020. All rights reserved.