Package com.adaptris.aws.sqs
Class AmazonSQSProducer
- java.lang.Object
-
- com.adaptris.core.AdaptrisMessageWorkerImp
-
- com.adaptris.core.AdaptrisMessageProducerImp
-
- com.adaptris.core.ProduceOnlyProducerImp
-
- com.adaptris.aws.sqs.AmazonSQSProducer
-
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisMessageProducer,AdaptrisMessageSender,AdaptrisMessageWorker,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator
@ComponentProfile(summary="Send messages to Amazon SQS", tag="producer,amazon,sqs", recommended=AmazonSQSConnection.class) public class AmazonSQSProducer extends ProduceOnlyProducerImpAdaptrisMessageProducerimplementation that sends messages to an Amazon Web Services (AWS) SQS queue.Amazon SQS receives only text therefore only the message payload is sent as a string.
- Since:
- 3.0.3
In the adapter configuration file this class is aliased as amazon-sqs-producer which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAmazonSQSProducer.SendMessageAsyncCallback
-
Field Summary
-
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
-
Constructor Summary
Constructors Constructor Description AmazonSQSProducer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voiddoProduce(AdaptrisMessage msg, java.lang.String endpoint)java.lang.Stringendpoint(AdaptrisMessage msg)java.lang.IntegergetDelaySeconds()Delay seconds for every messagejava.lang.StringgetOwnerAwsAccountId()The AWS account ID of the account that created the queue.java.lang.StringgetQueue()The SQS Queue name@NonNull java.util.List<java.lang.String>getSendAttributes()Specify a list of a metadata keys that should be attached to a message.voidinit()voidprepare()voidsetDelaySeconds(java.lang.Integer delaySeconds)Delay seconds for every messagevoidsetOwnerAwsAccountId(java.lang.String ownerAwsAccountId)The AWS account ID of the account that created the queue.voidsetQueue(java.lang.String queue)The SQS Queue namevoidsetSendAttributes(@NonNull java.util.List<java.lang.String> sendAttributes)Specify a list of a metadata keys that should be attached to a message.voidstart()voidstop()protected AmazonSQSProducerwithMessageAsyncCallback(AmazonSQSProducer.SendMessageAsyncCallback callback)AmazonSQSProducerwithQueue(java.lang.String s)-
Methods inherited from class com.adaptris.core.ProduceOnlyProducerImp
produce, request, request
-
Methods inherited from class com.adaptris.core.AdaptrisMessageProducerImp
createName
-
Methods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createQualifier, isTrackingEndpoint
-
-
-
-
Method Detail
-
prepare
public void prepare() throws CoreException- Throws:
CoreException
-
init
public void init() throws CoreException- Throws:
CoreException
-
start
public void start() throws CoreException- Throws:
CoreException
-
stop
public void stop()
-
close
public void close()
-
doProduce
public void doProduce(AdaptrisMessage msg, java.lang.String endpoint) throws ProduceException
- Specified by:
doProducein classProduceOnlyProducerImp- Throws:
ProduceException
-
withMessageAsyncCallback
protected AmazonSQSProducer withMessageAsyncCallback(AmazonSQSProducer.SendMessageAsyncCallback callback)
-
endpoint
public java.lang.String endpoint(AdaptrisMessage msg) throws ProduceException
- Specified by:
endpointin classAdaptrisMessageProducerImp- Throws:
ProduceException
-
withQueue
public AmazonSQSProducer withQueue(java.lang.String s)
-
getDelaySeconds
public java.lang.Integer getDelaySeconds()
Delay seconds for every message
-
setDelaySeconds
public void setDelaySeconds(java.lang.Integer delaySeconds)
Delay seconds for every message
-
getSendAttributes
@NonNull public @NonNull java.util.List<java.lang.String> getSendAttributes()
Specify a list of a metadata keys that should be attached to a message.Amazon SQS supports a limited set of attributes (10 at current count) that can be attached to a message; use this list to specify the metadata keys that must be sent as attributes, otherwise all metadata is ignored.
-
setSendAttributes
public void setSendAttributes(@NonNull @NonNull java.util.List<java.lang.String> sendAttributes)Specify a list of a metadata keys that should be attached to a message.Amazon SQS supports a limited set of attributes (10 at current count) that can be attached to a message; use this list to specify the metadata keys that must be sent as attributes, otherwise all metadata is ignored.
-
getOwnerAwsAccountId
public java.lang.String getOwnerAwsAccountId()
The AWS account ID of the account that created the queue. When omitted the default setting on the queue will be used.
-
setOwnerAwsAccountId
public void setOwnerAwsAccountId(java.lang.String ownerAwsAccountId)
The AWS account ID of the account that created the queue. When omitted the default setting on the queue will be used.
-
getQueue
public java.lang.String getQueue()
The SQS Queue name
-
setQueue
public void setQueue(java.lang.String queue)
The SQS Queue name
-
-