org.skyscreamer.nevado.jms.connector
Class AbstractSQSConnector
java.lang.Object
org.skyscreamer.nevado.jms.connector.AbstractSQSConnector
- All Implemented Interfaces:
- SQSConnector
- Direct Known Subclasses:
- AmazonAwsSQSConnector, MockSQSConnector, TypicaSQSConnector
public abstract class AbstractSQSConnector
- extends Object
- implements SQSConnector
Abstract connector that handles handling of messages and queues independent of the actual implementation.
- Author:
- Carter Page
|
Method Summary |
protected NevadoMessage |
convertSqsMessage(NevadoDestination destination,
SQSMessage sqsMessage,
boolean readOnly)
|
NevadoQueue |
createQueue(String queueName)
Create a queue |
void |
deleteMessage(NevadoMessage message)
|
void |
deleteQueue(NevadoQueue queue)
|
protected NevadoMessage |
deserializeMessage(String serializedMessage)
Deserializes the body of an SQS message into a NevadoMessage object. |
protected String |
getPolicy(String snsArn,
String sqsArn)
Creates the policy for a sqs subscription to sns |
protected SQSQueue |
getSQSQueue(NevadoDestination destination)
|
protected abstract SQSQueue |
getSQSQueueImpl(NevadoQueue queue)
|
NevadoMessage |
receiveMessage(NevadoConnection connection,
NevadoDestination destination,
long timeoutMs)
|
protected SQSMessage |
receiveSQSMessage(NevadoConnection connection,
NevadoDestination destination,
long timeoutMs,
long startTimeMs,
SQSQueue sqsQueue)
|
void |
resetMessage(NevadoMessage message)
|
void |
sendMessage(NevadoDestination destination,
NevadoMessage message)
|
void |
sendMessages(NevadoDestination destination,
List<NevadoMessage> outgoingMessages)
|
protected abstract void |
sendSNSMessage(NevadoTopic topic,
String serializedMessage)
|
protected String |
sendSQSMessage(NevadoQueue queue,
String serializedMessage)
|
protected String |
serializeMessage(NevadoMessage message)
Serialize a NevadoMessage object into the body of an SQS message into a bae64 string. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AWS_ERROR_CODE_AUTHENTICATION
protected static final String AWS_ERROR_CODE_AUTHENTICATION
- See Also:
- Constant Field Values
_log
protected final org.apache.commons.logging.Log _log
AbstractSQSConnector
protected AbstractSQSConnector(long receiveCheckIntervalMs)
sendMessage
public final void sendMessage(NevadoDestination destination,
NevadoMessage message)
throws javax.jms.JMSException
- Specified by:
sendMessage in interface SQSConnector
- Throws:
javax.jms.JMSException
sendMessages
public final void sendMessages(NevadoDestination destination,
List<NevadoMessage> outgoingMessages)
throws javax.jms.JMSException
- Specified by:
sendMessages in interface SQSConnector
- Throws:
javax.jms.JMSException
receiveMessage
public final NevadoMessage receiveMessage(NevadoConnection connection,
NevadoDestination destination,
long timeoutMs)
throws javax.jms.JMSException,
InterruptedException
- Specified by:
receiveMessage in interface SQSConnector
- Throws:
javax.jms.JMSException
InterruptedException
deleteMessage
public final void deleteMessage(NevadoMessage message)
throws javax.jms.JMSException
- Specified by:
deleteMessage in interface SQSConnector
- Throws:
javax.jms.JMSException
resetMessage
public final void resetMessage(NevadoMessage message)
throws javax.jms.JMSException
- Specified by:
resetMessage in interface SQSConnector
- Throws:
javax.jms.JMSException
createQueue
public final NevadoQueue createQueue(String queueName)
throws javax.jms.JMSException
- Create a queue
- Specified by:
createQueue in interface SQSConnector
- Parameters:
queueName - Name of queue to create
- Throws:
javax.jms.JMSException
deleteQueue
public void deleteQueue(NevadoQueue queue)
throws javax.jms.JMSException
- Specified by:
deleteQueue in interface SQSConnector
- Throws:
javax.jms.JMSException
sendSNSMessage
protected abstract void sendSNSMessage(NevadoTopic topic,
String serializedMessage)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
getSQSQueue
protected final SQSQueue getSQSQueue(NevadoDestination destination)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
getSQSQueueImpl
protected abstract SQSQueue getSQSQueueImpl(NevadoQueue queue)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
receiveSQSMessage
protected final SQSMessage receiveSQSMessage(NevadoConnection connection,
NevadoDestination destination,
long timeoutMs,
long startTimeMs,
SQSQueue sqsQueue)
throws javax.jms.JMSException,
InterruptedException
- Throws:
javax.jms.JMSException
InterruptedException
sendSQSMessage
protected final String sendSQSMessage(NevadoQueue queue,
String serializedMessage)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
convertSqsMessage
protected final NevadoMessage convertSqsMessage(NevadoDestination destination,
SQSMessage sqsMessage,
boolean readOnly)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
serializeMessage
protected final String serializeMessage(NevadoMessage message)
throws javax.jms.JMSException
- Serialize a NevadoMessage object into the body of an SQS message into a bae64 string.
- Parameters:
message - A NevadoMessage object
- Returns:
- A string-serialized encoding of the message
- Throws:
javax.jms.JMSException - Unable to serialize the message
deserializeMessage
protected final NevadoMessage deserializeMessage(String serializedMessage)
throws javax.jms.JMSException
- Deserializes the body of an SQS message into a NevadoMessage object.
- Parameters:
serializedMessage - String-serialized NevadoMessage
- Returns:
- A deserialized NevadoMessage object
- Throws:
javax.jms.JMSException - Unable to deserializeFromString a single NevadoMessage object from the source
getPolicy
protected final String getPolicy(String snsArn,
String sqsArn)
- Creates the policy for a sqs subscription to sns
- Parameters:
snsArn - ARN of SNS topic to subscribe tosqsArn - ARN of SQS queue subscriber
- Returns:
- Policy rule to create
Copyright © 2013. All Rights Reserved.