Skip to content

Commit

Permalink
refs #408: upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
JaidenAshmore committed Oct 5, 2024
1 parent 87d6e9e commit 04fd134
Show file tree
Hide file tree
Showing 37 changed files with 168 additions and 78 deletions.
9 changes: 0 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import com.jashmore.gradle.JacocoCoverallsPlugin
import com.jashmore.gradle.ReleasePlugin
import com.jashmore.gradle.release
import io.gitlab.arturbosch.detekt.detekt

plugins {
java
Expand All @@ -12,7 +11,6 @@ plugins {
id("com.github.spotbugs")
id("com.jashmore.gradle.github.release")
id("org.jlleitschuh.gradle.ktlint") apply false
id("io.gitlab.arturbosch.detekt") apply false
id("org.unbroken-dome.test-sets") version "4.0.0"
}

Expand Down Expand Up @@ -46,7 +44,6 @@ subprojects {
}
} else {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "io.gitlab.arturbosch.detekt")
}

dependencies {
Expand Down Expand Up @@ -86,12 +83,6 @@ subprojects {
excludeFilter.set(file("${project.rootDir}/configuration/spotbugs/bugsExcludeFilter.xml"))
}
}
} else {
detekt {
failFast = true
buildUponDefaultConfig = true
config = files("${project.rootDir}/configuration/detekt/detekt-configuration.yml")
}
}

tasks.withType<Test> {
Expand Down
7 changes: 0 additions & 7 deletions configuration/detekt/detekt-configuration.yml

This file was deleted.

1 change: 1 addition & 0 deletions configuration/spotbugs/bugsExcludeFilter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
</Match>
<Match>
<Source name="~.*generated-sources.*" />
<Source name="~.*generated-test-sources.*" />
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import software.amazon.awssdk.core.exception.SdkInterruptedException;
import software.amazon.awssdk.services.sqs.SqsAsyncClient;
import software.amazon.awssdk.services.sqs.model.Message;
import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName;
import software.amazon.awssdk.services.sqs.model.QueueAttributeName;
import software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest;
import software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse;
Expand Down Expand Up @@ -187,7 +188,7 @@ private ReceiveMessageRequest buildReceiveMessageRequest(final int numberOfMessa
final ReceiveMessageRequest.Builder requestBuilder = ReceiveMessageRequest
.builder()
.queueUrl(queueProperties.getQueueUrl())
.attributeNames(QueueAttributeName.ALL)
.messageSystemAttributeNames(MessageSystemAttributeName.ALL)
.messageAttributeNames(QueueAttributeName.ALL.toString())
.maxNumberOfMessages(numberOfMessagesToObtain)
.waitTimeSeconds(MAX_SQS_RECEIVE_WAIT_TIME_IN_SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import software.amazon.awssdk.core.exception.SdkInterruptedException;
import software.amazon.awssdk.services.sqs.SqsAsyncClient;
import software.amazon.awssdk.services.sqs.model.Message;
import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName;
import software.amazon.awssdk.services.sqs.model.QueueAttributeName;
import software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest;
import software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse;
Expand Down Expand Up @@ -166,7 +167,7 @@ private ReceiveMessageRequest buildReceiveMessageRequest() {
final ReceiveMessageRequest.Builder requestBuilder = ReceiveMessageRequest
.builder()
.queueUrl(queueProperties.getQueueUrl())
.attributeNames(QueueAttributeName.ALL)
.messageSystemAttributeNames(MessageSystemAttributeName.ALL)
.messageAttributeNames(QueueAttributeName.ALL.toString())
.waitTimeSeconds(MAX_SQS_RECEIVE_WAIT_TIME_IN_SECONDS)
.maxNumberOfMessages(numberOfMessagesToObtain);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.mockito.junit.jupiter.MockitoExtension;
import software.amazon.awssdk.services.sqs.SqsAsyncClient;
import software.amazon.awssdk.services.sqs.model.Message;
import software.amazon.awssdk.services.sqs.model.QueueAttributeName;
import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName;
import software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest;
import software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse;

Expand Down Expand Up @@ -453,8 +453,8 @@ void allMessageAttributesShouldBeDownloadedWhenRequestingMessages() {
ReceiveMessageRequest.class
);
verify(sqsAsyncClient).receiveMessage(receiveMessageRequestArgumentCaptor.capture());
assertThat(receiveMessageRequestArgumentCaptor.getValue().messageAttributeNames())
.containsExactly(QueueAttributeName.ALL.toString());
assertThat(receiveMessageRequestArgumentCaptor.getValue().messageSystemAttributeNames())
.containsExactly(MessageSystemAttributeName.ALL);
}

@Test
Expand Down Expand Up @@ -483,7 +483,8 @@ void allMessageSystemAttributesShouldBeDownloadedWhenRequestingMessages() {
ReceiveMessageRequest.class
);
verify(sqsAsyncClient).receiveMessage(receiveMessageRequestArgumentCaptor.capture());
assertThat(receiveMessageRequestArgumentCaptor.getValue().attributeNames()).containsExactly(QueueAttributeName.ALL);
assertThat(receiveMessageRequestArgumentCaptor.getValue().messageSystemAttributeNames())
.containsExactly(MessageSystemAttributeName.ALL);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import software.amazon.awssdk.core.exception.SdkInterruptedException;
import software.amazon.awssdk.services.sqs.SqsAsyncClient;
import software.amazon.awssdk.services.sqs.model.Message;
import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName;
import software.amazon.awssdk.services.sqs.model.QueueAttributeName;
import software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest;
import software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse;
Expand Down Expand Up @@ -406,8 +407,7 @@ void allMessageAttributesAreIncludedInMessagesWhenRetrieved() {
ReceiveMessageRequest.class
);
verify(sqsAsyncClient).receiveMessage(receiveMessageRequestArgumentCaptor.capture());
assertThat(receiveMessageRequestArgumentCaptor.getValue().messageAttributeNames())
.containsExactly(QueueAttributeName.ALL.toString());
assertThat(receiveMessageRequestArgumentCaptor.getValue().messageAttributeNames()).contains(QueueAttributeName.ALL.toString());
}

@Test
Expand All @@ -428,7 +428,7 @@ void allMessageSystemAttributesAreIncludedInMessagesWhenRetrieved() {
ReceiveMessageRequest.class
);
verify(sqsAsyncClient).receiveMessage(receiveMessageRequestArgumentCaptor.capture());
assertThat(receiveMessageRequestArgumentCaptor.getValue().attributeNames()).contains(QueueAttributeName.ALL);
assertThat(receiveMessageRequestArgumentCaptor.getValue().messageSystemAttributeNames()).contains(MessageSystemAttributeName.ALL);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Spring - How to version message payload Schemas using Spring Cloud Schema Registry

As your application grows over time the format of the data that needs to be sent in the SQS messages may change as well. To allow for
these changes, the [Spring Cloud Schema Registry](https://cloud.spring.io/spring-cloud-static/spring-cloud-schema-registry/1.0.0.RC1/reference/html/spring-cloud-schema-registry.html)
these changes, the [Spring Cloud Schema Registry](https://docs.spring.io/spring-cloud-schema-registry/docs/current/reference/html/spring-cloud-schema-registry.html)
can be used to track the version of your schemas, allowing the SQS consumer to be able to interpret multiple versions of your payload.

## Full reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private val log: Logger = LoggerFactory.getLogger("example")
private val CONCURRENCY_LEVEL_PERIOD = Duration.ofSeconds(5)
private const val CONCURRENCY_LIMIT = 10

private val objectMapper = ObjectMapper().registerModule(KotlinModule())
private val objectMapper = ObjectMapper().registerModule(KotlinModule.Builder().build())

/**
* This example shows the core framework being used to processing messages place onto the queue with a dynamic level of concurrency via the
Expand Down
2 changes: 1 addition & 1 deletion examples/spring-cloud-schema-registry-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This example shows how you can consume messages which have been defined using an [Avro](https://avro.apache.org/docs/1.9.2/gettingstartedjava.html)
Schema and
the [Spring Cloud Schema Registry](https://cloud.spring.io/spring-cloud-static/spring-cloud-schema-registry/1.0.0.RC1/reference/html/spring-cloud-schema-registry.html).
the [Spring Cloud Schema Registry](https://docs.spring.io/spring-cloud-schema-registry/docs/current/reference/html/spring-cloud-schema-registry.html).

To find the corresponding code look in the [Spring Cloud Schema Registry Extension](../../extensions/spring-cloud-schema-registry-extension) module.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.jashmore.sqs.examples;

import akka.http.scaladsl.Http;
import com.jashmore.sqs.spring.config.QueueListenerConfiguration;
import com.jashmore.sqs.spring.container.basic.QueueListener;
import com.jashmore.sqs.spring.container.prefetch.PrefetchingQueueListener;
import com.jashmore.sqs.util.LocalSqsAsyncClientImpl;
import com.jashmore.sqs.util.SqsQueuesConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.pekko.http.scaladsl.Http;
import org.elasticmq.rest.sqs.SQSRestServer;
import org.elasticmq.rest.sqs.SQSRestServerBuilder;
import org.springframework.boot.SpringApplication;
Expand Down
9 changes: 9 additions & 0 deletions extensions/aws-xray-extension/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@ dependencies {
testImplementation(project(":java-dynamic-sqs-listener-core"))
testImplementation(project(":expected-test-exception"))
}

configurations.all {
resolutionStrategy.eachDependency {
// xray requires an older version of jackson
if (requested.group.startsWith("com.fasterxml.jackson")) {
useVersion("2.15.2")
}
}
}
9 changes: 9 additions & 0 deletions extensions/aws-xray-extension/spring-boot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ dependencies {
testImplementation("org.springframework.boot:spring-boot-test")
testImplementation(project(":elasticmq-sqs-client"))
}

configurations.all {
resolutionStrategy.eachDependency {
// xray requires an older version of jackson
if (requested.group.startsWith("com.fasterxml.jackson")) {
useVersion("2.15.2")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public LocalSqsAsyncClient localSqsAsyncClient() {

@Bean
@Qualifier("sqsXrayRecorder")
public AWSXRayRecorder recorder() throws IOException {
public AWSXRayRecorder sqsXrayRecorder() throws IOException {
final DaemonConfiguration daemonConfiguration = new DaemonConfiguration();
daemonConfiguration.setDaemonAddress("localhost:" + XRAY_DAEMON_PORT);
final AWSXRayRecorder recorder = AWSXRayRecorderBuilder.standard().withEmitter(Emitter.create(daemonConfiguration)).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import com.jashmore.sqs.processor.MessageProcessor
* [ArgumentResolverServiceDslBuilder] that constructs a [CoreArgumentResolverService] for the [MessageProcessor].
*/
@MessageListenerComponentDslMarker
class CoreArgumentResolverServiceDslBuilder(private val objectMapper: ObjectMapper) : ArgumentResolverServiceDslBuilder {
class CoreArgumentResolverServiceDslBuilder(
private val objectMapper: ObjectMapper
) : ArgumentResolverServiceDslBuilder {

override fun invoke(): ArgumentResolverService {
return CoreArgumentResolverService(
Expand All @@ -33,5 +35,8 @@ class CoreArgumentResolverServiceDslBuilder(private val objectMapper: ObjectMapp
*
* @param init the DSL function for configuring this processor
*/
fun coreArgumentResolverService(objectMapper: ObjectMapper = ObjectMapper(), init: CoreArgumentResolverServiceDslBuilder.() -> Unit = { }) =
fun coreArgumentResolverService(
objectMapper: ObjectMapper = ObjectMapper(),
init: CoreArgumentResolverServiceDslBuilder.() -> Unit = { }
) =
initComponent(CoreArgumentResolverServiceDslBuilder(objectMapper), init)
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,6 @@ class ConcurrentMessageBrokerDslBuilder : MessageBrokerDslBuilder {
* }
* ```
*/
fun concurrentBroker(init: ConcurrentMessageBrokerDslBuilder.() -> Unit) = initComponent(ConcurrentMessageBrokerDslBuilder(), init)
fun concurrentBroker(
init: ConcurrentMessageBrokerDslBuilder.() -> Unit
) = initComponent(ConcurrentMessageBrokerDslBuilder(), init)
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ class GroupingMessageBrokerDslBuilder : MessageBrokerDslBuilder {

override fun getMaximumNumberOfCachedMessageGroups(): Int = maximumNumberOfCachedMessageGroups()

override fun messageGroupingFunction(): Function<Message, String> = Function { t -> actualMessageGroupingFunction(t) }
override fun messageGroupingFunction(): Function<Message, String> = Function { t ->
actualMessageGroupingFunction(
t
)
}
}
)
}
Expand All @@ -94,4 +98,6 @@ class GroupingMessageBrokerDslBuilder : MessageBrokerDslBuilder {
* }
* ```
*/
fun groupingBroker(init: GroupingMessageBrokerDslBuilder.() -> Unit) = initComponent(GroupingMessageBrokerDslBuilder(), init)
fun groupingBroker(
init: GroupingMessageBrokerDslBuilder.() -> Unit
) = initComponent(GroupingMessageBrokerDslBuilder(), init)
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ import software.amazon.awssdk.services.sqs.SqsAsyncClient
*
* <p>This only provides access to the processor object
*/
abstract class AbstractMessageListenerContainerDslBuilder(val identifier: String, val sqsAsyncClient: SqsAsyncClient, val queueProperties: QueueProperties) :
abstract class AbstractMessageListenerContainerDslBuilder(
val identifier: String,
val sqsAsyncClient: SqsAsyncClient,
val queueProperties: QueueProperties
) :
MessageListenerComponentDslBuilder<MessageListenerContainer> {
var processor: MessageProcessorDslBuilder? = null

Expand Down Expand Up @@ -72,5 +76,10 @@ abstract class AbstractMessageListenerContainerDslBuilder(val identifier: String
* ```
*/
fun asyncLambdaProcessor(init: AsyncLambdaMessageProcessorDslBuilder.() -> Unit) =
com.jashmore.sqs.core.kotlin.dsl.processor.asyncLambdaProcessor(identifier, sqsAsyncClient, queueProperties, init)
com.jashmore.sqs.core.kotlin.dsl.processor.asyncLambdaProcessor(
identifier,
sqsAsyncClient,
queueProperties,
init
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ fun batchingMessageListener(
queueUrl: String,
init: BatchingMessageListenerContainerDslBuilder.() -> Unit
): MessageListenerContainer {
return batchingMessageListener(identifier, sqsAsyncClient, QueueProperties.builder().queueUrl(queueUrl).build(), init)
return batchingMessageListener(
identifier,
sqsAsyncClient,
QueueProperties.builder().queueUrl(queueUrl).build(),
init
)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ import java.util.function.Supplier
* [AbstractMessageListenerContainerDslBuilder] that will construct a [MessageListenerContainer] for usage in this container.
*/
@MessageListenerComponentDslMarker
class CoreMessageListenerContainerDslBuilder(identifier: String, sqsAsyncClient: SqsAsyncClient, queueProperties: QueueProperties) :
class CoreMessageListenerContainerDslBuilder(
identifier: String,
sqsAsyncClient: SqsAsyncClient,
queueProperties: QueueProperties
) :
AbstractMessageListenerContainerDslBuilder(identifier, sqsAsyncClient, queueProperties) {
var broker: MessageBrokerDslBuilder? = null
var resolver: MessageResolverDslBuilder? = null
Expand All @@ -52,7 +56,9 @@ class CoreMessageListenerContainerDslBuilder(identifier: String, sqsAsyncClient:
* }
* ```
*/
fun concurrentBroker(init: ConcurrentMessageBrokerDslBuilder.() -> Unit) = com.jashmore.sqs.core.kotlin.dsl.broker.concurrentBroker(init)
fun concurrentBroker(
init: ConcurrentMessageBrokerDslBuilder.() -> Unit
) = com.jashmore.sqs.core.kotlin.dsl.broker.concurrentBroker(init)

/**
* Use the [GroupingMessageBroker] as the [MessageBroker] in this container.
Expand All @@ -67,7 +73,9 @@ class CoreMessageListenerContainerDslBuilder(identifier: String, sqsAsyncClient:
* }
* ```
*/
fun groupingBroker(init: GroupingMessageBrokerDslBuilder.() -> Unit) = com.jashmore.sqs.core.kotlin.dsl.broker.groupingBroker(init)
fun groupingBroker(
init: GroupingMessageBrokerDslBuilder.() -> Unit
) = com.jashmore.sqs.core.kotlin.dsl.broker.groupingBroker(init)

/**
* Use the [BatchingMessageRetriever] as the [MessageRetriever] for this container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ fun prefetchingMessageListener(
queueUrl: String,
init: PrefetchingMessageListenerContainerDslBuilder.() -> Unit
): MessageListenerContainer {
return prefetchingMessageListener(identifier, sqsAsyncClient, QueueProperties.builder().queueUrl(queueUrl).build(), init)
return prefetchingMessageListener(
identifier,
sqsAsyncClient,
QueueProperties.builder().queueUrl(queueUrl).build(),
init
)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ class AsyncLambdaMessageProcessorDslBuilder(

var decorators = mutableListOf<MessageProcessingDecorator>()

private var processorBuilder: () -> MessageProcessor = { throw RequiredFieldException("method", "LambdaMessageProcessor") }
private var processorBuilder: () -> MessageProcessor = {
throw RequiredFieldException(
"method",
"LambdaMessageProcessor"
)
}

fun method(func: (message: Message) -> CompletableFuture<*>) {
processorBuilder = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class CoreMessageProcessorDslBuilder(
*
* If this is not supplied, a default [CoreArgumentResolverService] will be used which configures the core argument resolvers.
*/
var argumentResolverService: ArgumentResolverServiceDslBuilder = CoreArgumentResolverServiceDslBuilder(ObjectMapper())
var argumentResolverService: ArgumentResolverServiceDslBuilder = CoreArgumentResolverServiceDslBuilder(
ObjectMapper()
)

/**
* The object instance that will execute the message listener method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ class LambdaMessageProcessorDslBuilder(
*/
var decorators = listOf<MessageProcessingDecorator>()

private var processorBuilder: () -> MessageProcessor = { throw RequiredFieldException("method", "LambdaMessageProcessor") }
private var processorBuilder: () -> MessageProcessor = {
throw RequiredFieldException(
"method",
"LambdaMessageProcessor"
)
}

/**
* Set the lambda as a method that just consumes the [Message].
Expand Down
Loading

0 comments on commit 04fd134

Please sign in to comment.