Skip to content

Commit 8fcc7be

Browse files
committed
Merge branch 'main' into feature/backpressure-limiter
2 parents 3b2dfb3 + 2e14170 commit 8fcc7be

File tree

71 files changed

+899
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+899
-133
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Java CI with Maven
22

33
on:
44
push:
5-
branches: [ main, 2.3.x, 2.4.x, 3.0.x, 3.1.x, 3.2.x ]
5+
branches: [ main, 2.3.x, 2.4.x, 3.0.x, 3.1.x, 3.2.x, 3.3.x ]
66
pull_request:
7-
branches: [ main, 2.3.x, 2.4.x, 3.0.x, 3.1.x, 3.2.x ]
7+
branches: [ main, 2.3.x, 2.4.x, 3.0.x, 3.1.x, 3.2.x, 3.3.x ]
88

99
permissions:
1010
contents: read
@@ -14,7 +14,7 @@ jobs:
1414
name: Test with JDK ${{ matrix.version }}
1515
strategy:
1616
matrix:
17-
version: [ 17.0.12, 21.0.4 ]
17+
version: [ 17.0.12, 21.0.4, 24 ]
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v4

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ clean:
1111

1212
docs:
1313
mvnd verify -Pdocs-classic -DskipTests=true
14+
15+
docs-full:
16+
mvnd verify javadoc:aggregate -Pdocs-classic -DskipTests=true

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ Spring Cloud AWS simplifies using AWS managed services in a Spring and Spring Bo
66

77
For a deep dive into the project, refer to the Spring Cloud AWS documentation:
88

9-
| Version | Reference Docs | API Docs |
10-
|---------------------------|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|
11-
| Spring Cloud AWS 3.3.0-M1 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.3.0-M1/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.3.0-M1/apidocs/index.html) |
12-
| Spring Cloud AWS 3.2.1 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.2.1/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.2.0/apidocs/index.html) |
13-
| Spring Cloud AWS 3.1.1 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.1.1/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.1.1/apidocs/index.html) |
14-
| Spring Cloud AWS 3.0.4 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.0.4/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.0.4/apidocs/index.html) |
15-
| Spring Cloud AWS 2.4.4 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/2.4.4/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/2.4.4/apidocs/index.html) |
16-
| Spring Cloud AWS 2.3.5 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/2.3.5/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/2.3.5/apidocs/index.html) |
9+
| Version | Reference Docs | API Docs |
10+
|------------------------|--------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
11+
| Spring Cloud AWS 3.3.0 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.3.0/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.3.0/apidocs/index.html) |
12+
| Spring Cloud AWS 3.2.1 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.2.1/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.2.1/apidocs/index.html) |
13+
| Spring Cloud AWS 3.1.1 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.1.1/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.1.1/apidocs/index.html) |
14+
| Spring Cloud AWS 3.0.4 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.0.4/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.0.4/apidocs/index.html) |
15+
| Spring Cloud AWS 2.4.4 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/2.4.4/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/2.4.4/apidocs/index.html) |
16+
| Spring Cloud AWS 2.3.5 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/2.3.5/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/2.3.5/apidocs/index.html) |
1717

1818
## Sponsors
1919

@@ -31,7 +31,8 @@ This project has dependency and transitive dependencies on Spring Projects. The
3131
| 2.4.x (maintenance mode) | [2021.0.x](https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2021.0-Release-Notes) (3.1/Jubilee) | 2.6.x, 2.7.x | 5.3.x | 1.x |
3232
| 3.0.x | [2022.0.x](https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2022.0-Release-Notes) (4.0/Kilburn) | 3.0.x, 3.1.x | 6.0.x | 2.x |
3333
| 3.1.x | [2023.0.x](https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2023.0-Release-Notes) (4.0/Kilburn) | 3.2.x | 6.1.x | 2.x |
34-
| 3.2.1 | [2023.0.x](https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2023.0-Release-Notes) (4.0/Kilburn) | 3.2.x, 3.3.x | 6.1.x | 2.x |
34+
| 3.2.x | [2023.0.x](https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2023.0-Release-Notes) (4.0/Kilburn) | 3.2.x, 3.3.x | 6.1.x | 2.x |
35+
| 3.3.x | [2024.0.x](https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2024.0-Release-Notes) | 3.4.x | 6.2.x | 2.x |
3536

3637
**Note**: 3.0.0-M2 is the last version compatible with Spring Boot 2.7.x and Spring Cloud 3.1. Starting from 3.0.0-M3, project has switched to Spring Boot 3.0.
3738

docs/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.awspring.cloud</groupId>
88
<artifactId>spring-cloud-aws</artifactId>
9-
<version>3.3.0-SNAPSHOT</version>
9+
<version>3.4.0-SNAPSHOT</version>
1010
</parent>
1111
<artifactId>spring-cloud-aws-docs</artifactId>
1212
<packaging>pom</packaging>

docs/src/main/asciidoc/_configprops.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
|spring.cloud.aws.sqs.listener.max-concurrent-messages | | The maximum concurrent messages that can be processed simultaneously for each queue. Note that if acknowledgement batching is being used, the actual maximum number of messages inflight might be higher.
9696
|spring.cloud.aws.sqs.listener.max-messages-per-poll | | The maximum number of messages to be retrieved in a single poll to SQS.
9797
|spring.cloud.aws.sqs.listener.poll-timeout | | The maximum amount of time for a poll to SQS.
98-
|spring.cloud.aws.sqs.queue-not-found-strategy | |
98+
|spring.cloud.aws.sqs.listener.max-delay-between-polls | | The maximum amount of time to wait between consecutive polls to SQS.
99+
|spring.cloud.aws.sqs.queue-not-found-strategy | |
99100
|spring.cloud.aws.sqs.region | | Overrides the default region.
100101

101102
|===

docs/src/main/asciidoc/s3.adoc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ try (OutputStream outputStream = s3Resource.getOutputStream()) {
129129

130130
=== S3 Client Side Encryption
131131

132-
AWS offers encryption library which is integrated inside of S3 Client called https://docs.aws.amazon.com/amazon-s3-encryption-client/latest/developerguide/what-is-s3-encryption-client.html [S3EncryptionClient].
132+
AWS offers encryption library which is integrated inside of S3 Client called https://docs.aws.amazon.com/amazon-s3-encryption-client/latest/developerguide/what-is-s3-encryption-client.html[S3EncryptionClient].
133133
With encryption client you are going to encrypt your files before sending them to S3 bucket.
134134

135135
To autoconfigure Encryption Client simply add the following dependency.
@@ -145,7 +145,7 @@ To autoconfigure Encryption Client simply add the following dependency.
145145

146146
We are supporting 3 types of encryption.
147147

148-
1. To configure encryption via KMS key specify 'spring.cloud.aws.s3.encryption.keyId' with KMS key arn and this key will be used to encrypt your files.
148+
1. To configure encryption via KMS key specify `spring.cloud.aws.s3.encryption.key-id` with KMS key arn and this key will be used to encrypt your files.
149149

150150
Also, following dependency is required.
151151
[source,xml]
@@ -158,10 +158,11 @@ Also, following dependency is required.
158158
----
159159

160160

161-
2. Asymmetric encryption is possible via RSA to enable it you will have to implement 'io.awspring.cloud.autoconfigure.s3.S3RsaProvider'
161+
2. Asymmetric encryption is possible via RSA to enable it you will have to implement `io.awspring.cloud.autoconfigure.s3.S3RsaProvider`
162162

163-
!Note you will have to manage storing private and public keys yourself otherwise you won't be able to decrypt the data later.
164-
Example of simple RSAProvider:
163+
NOTE: You will have to store private and public keys yourself otherwise you won't be able to decrypt the data later.
164+
165+
Example of simple `S3RsaProvider`:
165166

166167
[source,java,indent=0]
167168
----
@@ -185,8 +186,9 @@ public class MyRsaProvider implements S3RsaProvider {
185186

186187
3. Last option is if you want to use symmetric algorithm, this is possible via `io.awspring.cloud.autoconfigure.s3.S3AesProvider`
187188

188-
!Note you will have to manage storing storing private key!
189-
Example of simple AESProvider:
189+
NOTE: Ensure the private key is stored using secure storage mechanisms that prevent unauthorized access.
190+
191+
Example of simple `S3AesProvider`:
190192

191193
[source,java,indent=0]
192194
----

docs/src/main/asciidoc/secrets-manager.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ To load multiple secrets, separate their names with `;`:
4040
spring.config.import=aws-secretsmanager:/secrets/database-secrets;/secrets/webclient-secrets
4141
----
4242

43+
If you have the requirement to load secrets from another AWS account you can achieve this using the secret's ARN.
44+
45+
[source,properties]
46+
----
47+
spring.config.import=aws-secretsmanager:arn:aws:secretsmanager:eu-central-1:0123456789:secret:secrets/database-secrets
48+
----
49+
4350
If some secrets are required, and other ones are optional, list them as separate entries in `spring.config.import` property:
4451

4552
[source,properties]

docs/src/main/asciidoc/sqs.adoc

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public class SqsApplication {
4242
}
4343
----
4444

45+
IMPORTANT: Due to a classloader related https://github.com/awspring/spring-cloud-aws/issues/657[issue] it is currently not possible to use @SqsListener together with Spring Boot DevTools.
46+
4547
Without Spring Boot, it's necessary to import the `SqsBootstrapConfiguration` class in a `@Configuration`, as well as declare a `SqsMessageListenerContainerFactory` bean.
4648

4749
[source, java]
@@ -592,6 +594,8 @@ MessageListenerContainer<Object> myListenerContainer(SqsAsyncClient sqsAsyncClie
592594
The simplest way to consume `SQS` messages is by annotating a method in a `@Component` class with the `@SqsListener` annotation.
593595
The framework will then create the `MessageListenerContainer` and set a `MessagingMessageListenerAdapter` to invoke the method when a message is received.
594596

597+
IMPORTANT: Due to a classloader related https://github.com/awspring/spring-cloud-aws/issues/657[issue] it is currently not possible to use @SqsListener together with Spring Boot DevTools.
598+
595599
When using `Spring Boot` with `auto-configuration`, no configuration is necessary.
596600

597601
Most attributes on the annotation can be resolved from SpEL `(#{...})` or property placeholders `(${...})`.
@@ -639,6 +643,16 @@ public void listen(@SnsNotificationMessage List<Pojo> pojos) {
639643
}
640644
----
641645

646+
Since 3.3.1 you can also retrieve the subject of the SNS message through the `@SnsNotificationSubject` annotation.
647+
648+
[source, java]
649+
----
650+
@SqsListener("my-queue")
651+
public void listen(@SnsNotificationSubject String subject, @SnsNotificationMessage Pojo pojo) {
652+
System.out.println("received message for subject %s: %s".formatted(subject, pojo));
653+
}
654+
----
655+
642656
===== Specifying a MessageListenerContainerFactory
643657
A `MessageListenerContainerFactory` can be specified through the `factory` property.
644658
Such factory will then be used to create the container for the annotated method.
@@ -802,6 +816,7 @@ The Spring Boot Starter for SQS provides the following auto-configuration proper
802816
| <<maxConcurrentMessages, `spring.cloud.aws.sqs.listener.max-inflight-messages-per-queue`>> | Maximum number of inflight messages per queue. | No | 10
803817
| <<maxMessagesPerPoll, `spring.cloud.aws.sqs.listener.max-messages-per-poll`>> | Maximum number of messages to be received per poll. | No | 10
804818
| <<pollTimeout, `spring.cloud.aws.sqs.listener.poll-timeout`>> | Maximum amount of time to wait for messages in a poll. | No | 10 seconds
819+
| <<maxDelayBetweenPolls, `spring.cloud.aws.sqs.listener.max-delay-between-polls`>> | Maximum amount of time to wait between polls. | No | 10 seconds
805820
| `spring.cloud.aws.sqs.queue-not-found-strategy` | The strategy to be used by SqsTemplate and SqsListeners when a queue does not exist. | No | CREATE
806821
|===
807822

@@ -1233,6 +1248,34 @@ If the error handler execution succeeds, i.e. no error is thrown from the error
12331248
IMPORTANT: If the message should not be acknowledged and the `ON_SUCCESS` acknowledgement mode is set, it's important to propagate the error.
12341249
For simply executing an action in case of errors, an `interceptor` should be used instead, checking the presence of the `throwable` argument for detecting a failed execution.
12351250

1251+
==== Immediate Retry Error Handler
1252+
As mentioned in <<Error Handling>>, by default, messages that cause an error in the listener are only retried after the visibility timeout has expired.
1253+
1254+
Starting with version 3.4, Spring Cloud AWS SQS includes the `ImmediateRetryAsyncErrorHandler`, which sets the visibility timeout to zero to enable immediate retry of failed messages.
1255+
1256+
When using auto-configured factory, simply declare a `@Bean` and the error handler will be set
1257+
1258+
[source, java]
1259+
----
1260+
@Bean
1261+
public AsyncErrorHandler<Object> asyncErrorHandler() {
1262+
return new ImmediateRetryAsyncErrorHandler<>();
1263+
}
1264+
----
1265+
1266+
Alternatively, `ImmediateRetryAsyncErrorHandler` can be set in the `MessageListenerContainerFactory` or directly in the `MessageListenerContainer`:
1267+
1268+
[source, java]
1269+
----
1270+
@Bean
1271+
public SqsMessageListenerContainerFactory<Object> defaultSqsListenerContainerFactory() {
1272+
return SqsMessageListenerContainerFactory
1273+
.builder()
1274+
.sqsAsyncClientSupplier(BaseSqsIntegrationTest::createAsyncClient)
1275+
.errorHandler(new ImmediateRetryAsyncErrorHandler<>())
1276+
.build();
1277+
}
1278+
----
12361279

12371280
=== Message Conversion and Payload Deserialization
12381281

@@ -1715,7 +1758,10 @@ Following IAM permissions are required by Spring Cloud AWS SQS:
17151758

17161759
[cols="2"]
17171760
|===
1718-
| Send message to Queue
1761+
| To access the queue by its name or ARN instead of the URL
1762+
| `sqs:GetQueueUrl`
1763+
1764+
| Send message to queue
17191765
| `sqs:SendMessage`
17201766

17211767
| Receive message from queue
@@ -1727,9 +1773,6 @@ Following IAM permissions are required by Spring Cloud AWS SQS:
17271773
| To use sqsListener with SimpleMessageListenerContainerFactory you will need to add as well
17281774
| `sqs:GetQueueAttributes`
17291775

1730-
| To use SqsListener with Sqs name instead of ARN you will need
1731-
| `sqs:GetQueueUrl`
1732-
17331776
|===
17341777

17351778
Sample IAM policy granting access to SQS:

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<groupId>io.awspring.cloud</groupId>
1414
<artifactId>spring-cloud-aws</artifactId>
15-
<version>3.3.0-SNAPSHOT</version>
15+
<version>3.4.0-SNAPSHOT</version>
1616
<packaging>pom</packaging>
1717
<name>Spring Cloud AWS</name>
1818

@@ -134,7 +134,7 @@
134134
</links>
135135
<author>true</author>
136136
<header>${project.name}</header>
137-
<reportOutputDirectory>${project.build.directory}/site/${project.version}/apidocs</reportOutputDirectory>
137+
<outputDirectory>${project.build.directory}/site/${project.version}/</outputDirectory>
138138
<source>17</source>
139139
</configuration>
140140
</plugin>

spring-cloud-aws-autoconfigure/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>io.awspring.cloud</groupId>
99
<artifactId>spring-cloud-aws</artifactId>
10-
<version>3.3.0-SNAPSHOT</version>
10+
<version>3.4.0-SNAPSHOT</version>
1111
</parent>
1212

1313
<artifactId>spring-cloud-aws-autoconfigure</artifactId>

0 commit comments

Comments
 (0)