Class 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 ProduceOnlyProducerImp
AdaptrisMessageProducer implementation 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.

  • Constructor Details

    • AmazonSQSProducer

      public AmazonSQSProducer()
  • Method Details

    • 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, String endpoint) throws ProduceException
      Specified by:
      doProduce in class ProduceOnlyProducerImp
      Throws:
      ProduceException
    • messageGroupId

      protected String messageGroupId(AdaptrisMessage msg) throws Exception
      Throws:
      Exception
    • withMessageAsyncCallback

      protected AmazonSQSProducer withMessageAsyncCallback(AmazonSQSProducer.SendMessageAsyncCallback callback)
    • endpoint

      public String endpoint(AdaptrisMessage msg) throws ProduceException
      Specified by:
      endpoint in class AdaptrisMessageProducerImp
      Throws:
      ProduceException
    • withQueue

      public AmazonSQSProducer withQueue(String s)
    • getDelaySeconds

      public Integer getDelaySeconds()
      Delay seconds for every message
    • setDelaySeconds

      public void setDelaySeconds(Integer delaySeconds)
      Delay seconds for every message
    • getSendAttributes

      @NonNull public @NonNull List<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 List<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 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(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 String getQueue()
      The SQS Queue name
    • setQueue

      public void setQueue(String queue)
      The SQS Queue name
    • getMessageGroupId

      public String getMessageGroupId()

      This parameter applies only to FIFO (first-in-first-out) queues.

      The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). To interleave multiple ordered streams within a single queue, use MessageGroupId values (for example, session data for multiple users).

      • You must associate a non-empty MessageGroupId with a message. If you don't provide a MessageGroupId, the action fails.

      • ReceiveMessage might return messages with multiple MessageGroupId values. For each MessageGroupId, the messages are sorted by time sent. The caller can't specify a MessageGroupId.

      The length of MessageGroupId is 128 characters. Valid values: alphanumeric characters and punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

      For best practices of using MessageGroupId, see Using the MessageGroupId Property in the Amazon SQS Developer Guide.

      MessageGroupId is required for FIFO queues. You can't use it for Standard queues.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • setMessageGroupId

      public void setMessageGroupId(String messageGroupId)

      This parameter applies only to FIFO (first-in-first-out) queues.

      The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). To interleave multiple ordered streams within a single queue, use MessageGroupId values (for example, session data for multiple users).

      • You must associate a non-empty MessageGroupId with a message. If you don't provide a MessageGroupId, the action fails.

      • ReceiveMessage might return messages with multiple MessageGroupId values. For each MessageGroupId, the messages are sorted by time sent. The caller can't specify a MessageGroupId.

      The length of MessageGroupId is 128 characters. Valid values: alphanumeric characters and punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~).

      For best practices of using MessageGroupId, see Using the MessageGroupId Property in the Amazon SQS Developer Guide.

      MessageGroupId is required for FIFO queues. You can't use it for Standard queues.

      Parameters:
      messageGroupId -