Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set version to 3.0.2 #866

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ For a deep dive into the project, refer to the Spring Cloud AWS documentation:

| Version | Reference Docs | API Docs |
|------------------------|--------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| Spring Cloud AWS 3.0.1 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.0.1/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.0.1/apidocs/index.html) |
| Spring Cloud AWS 3.0.2 | [Reference Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.0.2/reference/html/index.html) | [API Docs](https://docs.awspring.io/spring-cloud-aws/docs/3.0.2/apidocs/index.html) |
| 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) |
| 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) |

Expand Down
2 changes: 1 addition & 1 deletion docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<artifactId>spring-cloud-aws-docs</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
<packaging>pom</packaging>
<name>Spring Cloud AWS</name>

Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>

<artifactId>spring-cloud-aws-autoconfigure</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>

<artifactId>spring-cloud-aws-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-dependencies</artifactId>
<name>Spring Cloud AWS Dependencies</name>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
<packaging>pom</packaging>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-dynamodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-aws</artifactId>
<groupId>io.awspring.cloud</groupId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-aws-dynamodb</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-parameter-store/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-s3-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-s3-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>

<artifactId>spring-cloud-aws-s3-codegen</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-s3-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>

<artifactId>spring-cloud-aws-s3-cross-region-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-s3-parent/spring-cloud-aws-s3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-s3-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>

<artifactId>spring-cloud-aws-s3</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ public interface S3Operations {
* @param s3Url - the S3 url s3://bucket/key
*/
void deleteObject(String s3Url);

/**
* Returns some or all (up to 1,000) of the objects in a bucket.
* Does not handle pagination. If you need pagination you should use {@link S3PathMatchingResourcePatternResolver} or {@link S3Client}
* Returns some or all (up to 1,000) of the objects in a bucket. Does not handle pagination. If you need pagination
* you should use {@link S3PathMatchingResourcePatternResolver} or {@link S3Client}
*
* @param bucketName - the bucket name
* @param prefix - objects prefix
* @return list of {@link S3Resource}
*/
List<S3Resource> listObjects(String bucketName, String prefix);

/**
* Stores a Java object in a S3 bucket. Uses {@link S3ObjectConverter} for serialization.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.net.URL;
import java.time.Duration;
import java.util.List;
import java.util.stream.Collectors;

import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StreamUtils;
Expand Down Expand Up @@ -89,19 +87,19 @@ public void deleteObject(String s3Url) {
Location location = Location.of(s3Url);
this.deleteObject(location.getBucket(), location.getObject());
}

@Override
public List<S3Resource> listObjects(String bucketName, String prefix) {
Assert.notNull(bucketName, "bucketName is required");
Assert.notNull(prefix, "prefix is required");

final ListObjectsV2Request request = ListObjectsV2Request.builder().bucket(bucketName).prefix(prefix).build();
final ListObjectsV2Response response = s3Client.listObjectsV2(request);

return response.contents().stream()
.map(s3Object -> new S3Resource(bucketName, s3Object.key(), s3Client, s3OutputStreamProvider)).toList();
.map(s3Object -> new S3Resource(bucketName, s3Object.key(), s3Client, s3OutputStreamProvider)).toList();
}

@Override
public S3Resource store(String bucketName, String key, Object object) {
Assert.notNull(bucketName, "bucketName is required");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
Expand Down Expand Up @@ -154,15 +153,16 @@ void listObjects() throws IOException {
client.putObject(r -> r.bucket(BUCKET_NAME).key("hello-en.txt"), RequestBody.fromString("hello"));
client.putObject(r -> r.bucket(BUCKET_NAME).key("hello-fr.txt"), RequestBody.fromString("bonjour"));
client.putObject(r -> r.bucket(BUCKET_NAME).key("bye.txt"), RequestBody.fromString("bye"));

List<S3Resource> resources = s3Template.listObjects(BUCKET_NAME, "hello");
assertThat(resources.size()).isEqualTo(2);

// According to the S3Client doc : "Objects are returned sorted in an ascending order of the respective key names in the list."
assertThat(resources).extracting(S3Resource::getInputStream).map(is -> new String(is.readAllBytes(), StandardCharsets.UTF_8))
.containsExactly("hello", "bonjour");
// According to the S3Client doc : "Objects are returned sorted in an ascending order of the respective key
// names in the list."
assertThat(resources).extracting(S3Resource::getInputStream)
.map(is -> new String(is.readAllBytes(), StandardCharsets.UTF_8)).containsExactly("hello", "bonjour");
}

@Test
void storesObject() throws IOException {
S3Resource storedObject = s3Template.store(BUCKET_NAME, "person.json", new Person("John", "Doe"));
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-samples/infrastructure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-samples</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>

<artifactId>spring-cloud-aws-samples-infrastructure</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-aws</artifactId>
<groupId>io.awspring.cloud</groupId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-aws-samples</artifactId>
<groupId>io.awspring.cloud</groupId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-samples</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-samples</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-samples</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>

<artifactId>spring-cloud-aws-secrets-manager-sample</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-samples</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-aws-samples</artifactId>
<groupId>io.awspring.cloud</groupId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-aws-sns-sample</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-aws-samples</artifactId>
<groupId>io.awspring.cloud</groupId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-aws-sqs-sample</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2013-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.awspring.cloud.sqs.sample;

import io.awspring.cloud.sqs.annotation.SqsListener;
Expand All @@ -6,6 +21,10 @@
import io.awspring.cloud.sqs.listener.acknowledgement.AcknowledgementResultCallback;
import io.awspring.cloud.sqs.listener.acknowledgement.handler.AcknowledgementMode;
import io.awspring.cloud.sqs.operations.SqsTemplate;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Collection;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationRunner;
Expand All @@ -14,11 +33,6 @@
import org.springframework.messaging.Message;
import software.amazon.awssdk.services.sqs.SqsAsyncClient;

import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Collection;
import java.util.UUID;

@Configuration
public class SqsManualAckSample {

Expand All @@ -29,16 +43,12 @@ public class SqsManualAckSample {
@Bean
public ApplicationRunner sendMessageToQueue(SqsTemplate sqsTemplate) {
LOGGER.info("Sending message");
return args -> sqsTemplate.send(to -> to.queue(NEW_USER_QUEUE)
.payload(new User(UUID.randomUUID(), "John"))
);
return args -> sqsTemplate.send(to -> to.queue(NEW_USER_QUEUE).payload(new User(UUID.randomUUID(), "John")));
}

@Bean
public SqsTemplate sqsTemplate(SqsAsyncClient sqsAsyncClient) {
return SqsTemplate.builder()
.sqsAsyncClient(sqsAsyncClient)
.build();
return SqsTemplate.builder().sqsAsyncClient(sqsAsyncClient).build();
}

@SqsListener(NEW_USER_QUEUE)
Expand All @@ -49,16 +59,12 @@ public void listen(Message<User> message) {

@Bean
SqsMessageListenerContainerFactory<Object> defaultSqsListenerContainerFactory(SqsAsyncClient sqsAsyncClient) {
return SqsMessageListenerContainerFactory
.builder()
.configure(options -> options
.acknowledgementMode(AcknowledgementMode.MANUAL)
.acknowledgementInterval(Duration.ofSeconds(3)) // NOTE: With acknowledgementInterval 3 seconds, we can batch and ack async.
.acknowledgementThreshold(0)
)
.acknowledgementResultCallback(new AckResultCallback())
.sqsAsyncClient(sqsAsyncClient)
.build();
return SqsMessageListenerContainerFactory.builder()
.configure(options -> options.acknowledgementMode(AcknowledgementMode.MANUAL)
.acknowledgementInterval(Duration.ofSeconds(3)) // NOTE: With acknowledgementInterval 3 seconds,
// we can batch and ack async.
.acknowledgementThreshold(0))
.acknowledgementResultCallback(new AckResultCallback()).sqsAsyncClient(sqsAsyncClient).build();
}

public record User(UUID id, String name) {
Expand All @@ -67,7 +73,8 @@ public record User(UUID id, String name) {
static class AckResultCallback implements AcknowledgementResultCallback<Object> {
@Override
public void onSuccess(Collection<Message<Object>> messages) {
LOGGER.info("Ack with success at {}", OffsetDateTime.now()); }
LOGGER.info("Ack with success at {}", OffsetDateTime.now());
}

@Override
public void onFailure(Collection<Message<Object>> messages, Throwable t) {
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-secrets-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-ses/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-aws-sns/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>spring-cloud-aws</artifactId>
<groupId>io.awspring.cloud</groupId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Loading
Loading