Package io.atleon.aws.sqs
Class SqsSender
- java.lang.Object
-
- io.atleon.aws.sqs.SqsSender
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public final class SqsSender extends Object implements Closeable
A low-level sender ofSqsMessages. Sent Messages contain the raw String body payload and may reference correlated metadata that is propagated downstream with the Result of sending any given Message.At most one instance of an
SqsAsyncClientis kept and can be closed upon invokingclose(). However, if after closing, more sent Publishers are subscribed to, a new Client instance will be created and cached.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSqsSender.MessageSendFailedException
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static SqsSendercreate(SqsSenderOptions options)Creates a reactive SQS sender with the specified configuration options.<C> Mono<SqsSenderResult<C>>send(SqsSenderMessage<C> message, String queueUrl)Sends a singleSqsSenderMessageto the provided queue URL<C> Flux<SqsSenderResult<C>>send(org.reactivestreams.Publisher<SqsSenderMessage<C>> messages, String queueUrl)Sends a sequence ofSqsSenderMessages to the provided SQS queue URL
-
-
-
Method Detail
-
create
public static SqsSender create(SqsSenderOptions options)
Creates a reactive SQS sender with the specified configuration options.
-
send
public <C> Mono<SqsSenderResult<C>> send(SqsSenderMessage<C> message, String queueUrl)
Sends a singleSqsSenderMessageto the provided queue URL- Type Parameters:
C- The type of correlated metadata associated with the sent message- Parameters:
message- A message to sendqueueUrl- The URL of the queue to which the message will be sent- Returns:
- A Publisher of the result of sending the message
-
send
public <C> Flux<SqsSenderResult<C>> send(org.reactivestreams.Publisher<SqsSenderMessage<C>> messages, String queueUrl)
Sends a sequence ofSqsSenderMessages to the provided SQS queue URLWhen maxRequestsInFlight is <= 1, results will be published in the same order that their corresponding messages are sent. If maxRequestsInFlight is > 1, it is possible that results may be emitted out of order as concurrent requests may complete with differing latencies.
- Type Parameters:
C- The type of correlated metadata associated with the sent messages- Parameters:
messages- A Publisher of SqsSenderMessages to sendqueueUrl- The URL of the queue to which the messages will be sent- Returns:
- A Publisher of the results of sending each message
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-