Skip to content

Commit

Permalink
run prettier on micronaut files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaiden Ashmore authored and Jaiden Ashmore committed Oct 19, 2024
1 parent 500146f commit f4efc34
Show file tree
Hide file tree
Showing 40 changed files with 287 additions and 352 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ lombok.config
.husky

org.springframework.boot.autoconfigure.AutoConfiguration.imports
io.micronaut.inject.annotation.AnnotationTransformer

doc/resources/**/*.xml
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ See the [Ktor Core Example](examples/ktor-example) for a full example running a
annotationProcessor("com.jashmore:java-dynamic-sqs-listener-micronaut-inject-java:${sqs.listener.version}")
}
```

Micronaut will use this at compile time to transform usages of core listener annotations to enable
method processors to register annotated methods as message listeners.

Expand All @@ -298,7 +298,6 @@ See the [Ktor Core Example](examples/ktor-example) for a full example running a
This will use any configured `SqsAsyncClient` in the application context for connecting to the queue, otherwise a default
will be provided that will look for AWS credentials/region from multiple areas, like the environment variables.


## Core Infrastructure

This library has been divided into isolated components each with distinct responsibilities. The following is a diagram describing a simple flow of a
Expand Down Expand Up @@ -339,6 +338,7 @@ for compatibility.
- [SLF4J API](https://github.com/qos-ch/slf4j)

The following require all the core dependencies above.

- [Spring Framework](./spring)
- [Spring Boot](https://github.com/spring-projects/spring-boot)
- [Ktor Framework](./ktor)
Expand Down Expand Up @@ -437,13 +437,16 @@ public class MyMessageListener {
}
}
}

```

### Micronaut

The `micronaut-core` library is applied pretty much the same way as `spring-starter`,
so for Micronaut it will be useful to look through the Spring guides and examples.

### Spring - Adding a custom argument resolver

There are some core [ArgumentResolvers](./api/src/main/java/com/jashmore/sqs/argument/ArgumentResolver.java) provided in the
application but custom ones can be defined if they don't cover your use case. As an example, the following is how we can populate the message listener
argument with the payload in uppercase.
Expand Down Expand Up @@ -504,6 +507,7 @@ argument with the payload in uppercase.
return new UppercasePayloadArgumentResolver();
}
}
```
1. Use the new annotation in your message listener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
public class TestApplication {

public static void main(String[] args) {
Micronaut.build(args)
.mainClass(TestApplication.class)
.start();
Micronaut.build(args).mainClass(TestApplication.class).start();
}

@Singleton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
java-dynamic-sqs-listener-micronaut:
auto-start-containers-enabled: true # default
auto-start-containers-enabled: true # default
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.jashmore.sqs.examples.integrationtests;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.*;

import com.jashmore.sqs.elasticmq.ElasticMqSqsAsyncClient;
import com.jashmore.sqs.util.ExpectedTestException;
import com.jashmore.sqs.util.LocalSqsAsyncClient;
Expand All @@ -10,21 +14,16 @@
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

import java.time.Duration;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.*;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

@MicronautTest
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.jashmore.sqs.argument;

import static org.assertj.core.api.Assertions.assertThat;

import com.jashmore.sqs.annotations.core.basic.QueueListener;
import com.jashmore.sqs.elasticmq.ElasticMqSqsAsyncClient;
import com.jashmore.sqs.util.LocalSqsAsyncClient;
Expand All @@ -8,18 +10,15 @@
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import software.amazon.awssdk.services.sqs.model.Message;
import software.amazon.awssdk.services.sqs.model.SendMessageRequest;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import static org.assertj.core.api.Assertions.assertThat;

@Slf4j
@MicronautTest(environments = "MessageArgumentResolutionMicronautIntegrationTest")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.jashmore.sqs.argument;

import static org.assertj.core.api.Assertions.assertThat;

import com.jashmore.sqs.annotations.core.basic.QueueListener;
import com.jashmore.sqs.argument.attribute.MessageAttribute;
import com.jashmore.sqs.argument.attribute.MessageAttributeDataTypes;
Expand All @@ -10,19 +12,16 @@
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import software.amazon.awssdk.services.sqs.model.MessageAttributeValue;
import software.amazon.awssdk.services.sqs.model.SendMessageRequest;

import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import static org.assertj.core.api.Assertions.assertThat;

@SuppressWarnings("unused")
@Slf4j
@MicronautTest(environments = "MessageAttributeMicronautIntegrationTest")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.jashmore.sqs.argument;

import static java.time.temporal.ChronoUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.within;

import com.jashmore.sqs.annotations.core.basic.QueueListener;
import com.jashmore.sqs.argument.attribute.MessageAttributeDataTypes;
import com.jashmore.sqs.argument.attribute.MessageSystemAttribute;
Expand All @@ -10,23 +14,18 @@
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import software.amazon.awssdk.services.sqs.model.MessageAttributeValue;
import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName;
import software.amazon.awssdk.services.sqs.model.SendMessageRequest;

import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import static java.time.temporal.ChronoUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.within;

@SuppressWarnings("unused")
@Slf4j
@MicronautTest(environments = "MessageSystemAttributeMicronautIntegrationTest")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Singleton;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import software.amazon.awssdk.services.sqs.SqsAsyncClient;
import software.amazon.awssdk.services.sqs.model.Message;
import software.amazon.awssdk.services.sqs.model.SendMessageRequest;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeUnit;

@SuppressWarnings("unused")
@Slf4j
@MicronautTest(environments = "MultipleSqsAsyncClientIntegrationTest")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.jashmore.sqs.container.basic;

import static org.assertj.core.api.Assertions.assertThat;

import com.jashmore.sqs.annotations.core.basic.QueueListener;
import com.jashmore.sqs.argument.payload.Payload;
import com.jashmore.sqs.elasticmq.ElasticMqSqsAsyncClient;
Expand All @@ -10,16 +12,13 @@
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;

import static org.assertj.core.api.Assertions.assertThat;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

@Slf4j
@MicronautTest(environments = "QueueListenerEnvironmentIntegrationTest")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.jashmore.sqs.container.basic;

import static org.assertj.core.api.Assertions.assertThat;

import com.jashmore.sqs.annotations.core.basic.QueueListener;
import com.jashmore.sqs.argument.payload.Payload;
import com.jashmore.sqs.elasticmq.ElasticMqSqsAsyncClient;
Expand All @@ -9,17 +11,14 @@
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;

import static org.assertj.core.api.Assertions.assertThat;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

@Slf4j
@MicronautTest(environments = "QueueListenerIntegrationTest")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.jashmore.sqs.container.basic;

import static org.assertj.core.api.Assertions.assertThat;

import com.jashmore.sqs.annotations.core.basic.QueueListener;
import com.jashmore.sqs.decorator.MessageProcessingContext;
import com.jashmore.sqs.decorator.MessageProcessingDecorator;
Expand All @@ -10,18 +12,15 @@
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.slf4j.MDC;
import software.amazon.awssdk.services.sqs.model.Message;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import static org.assertj.core.api.Assertions.assertThat;

@Slf4j
@MicronautTest(environments = "QueueListenerMessageDecoratorIntegrationTest")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.jashmore.sqs.container.basic;

import static org.assertj.core.api.Assertions.assertThat;

import com.jashmore.sqs.annotations.core.basic.QueueListener;
import com.jashmore.sqs.argument.payload.Payload;
import com.jashmore.sqs.elasticmq.ElasticMqSqsAsyncClient;
Expand All @@ -11,15 +13,12 @@
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import static org.assertj.core.api.Assertions.assertThat;

@Slf4j
@MicronautTest(environments = "QueueListenerVisibilityIntegrationTest")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.jashmore.sqs.container.fifo;

import static org.assertj.core.api.Assertions.assertThat;

import com.jashmore.sqs.annotations.core.fifo.FifoQueueListener;
import com.jashmore.sqs.argument.attribute.MessageSystemAttribute;
import com.jashmore.sqs.argument.payload.Payload;
Expand All @@ -12,12 +14,6 @@
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName;
import software.amazon.awssdk.services.sqs.model.SendMessageBatchRequestEntry;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -26,8 +22,11 @@
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

import static org.assertj.core.api.Assertions.assertThat;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName;
import software.amazon.awssdk.services.sqs.model.SendMessageBatchRequestEntry;

@Slf4j
@MicronautTest(environments = "FifoMessageListenerContainerFactoryTest")
Expand Down
Loading

0 comments on commit f4efc34

Please sign in to comment.