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

Guide: Connect a Micronaut JMS Application to an AWS SQS Queue #1160

Merged
merged 10 commits into from
Nov 28, 2022

Conversation

sbodvanski
Copy link
Contributor

No description provided.

Copy link
Member

@burtbeckwith burtbeckwith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, only minor changes needed

Copy link
Member

@alvarosanchez alvarosanchez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guide is using AWS SDK v1's com.amazonaws.services.sqs.AmazonSQS. It should also (or only) demonstrate how to use v2's software.amazon.awssdk.services.sqs.SqsClient, which is preconfigured by our micronaut-aws-sdk-v2

@sbodvanski
Copy link
Contributor Author

AWS SDK v1's

I think that the current SQS sub-module in micronaut-jms supports only AWS SDK v1's (https://github.com/micronaut-projects/micronaut-jms/blob/master/jms-sqs/build.gradle). My understanding is that to support SDK V2, we will have to add a new module to micronaut-jms. Probably, that should be addressed in a separate ticket.

@alvarosanchez please take a look and let me know if I overlooked something, and if there is a way to work around the version restriction in the micronaut-jms module.

@alvarosanchez
Copy link
Member

This is so funny, because a random guy already noticed that some time ago: micronaut-projects/micronaut-jms#35

😅

@sbodvanski
Copy link
Contributor Author

@sbodvanski
Copy link
Contributor Author

This is so funny, because a random guy already noticed that some time ago: micronaut-projects/micronaut-jms#35

😅

Do you guys think it is still worth finishing this guide (JMS AWS SDK v1.x integration)? When support for SDK v2 is added to micronaut-jms, we could provide the V2 guide.

@alvarosanchez
Copy link
Member

Do you guys think it is still worth finishing this guide (JMS AWS SDK v1.x integration)? When support for SDK v2 is added to micronaut-jms, we could provide the V2 guide.

Sure! Just address pending feedback, and then we can assign it to Sergio for publishing

@sbodvanski
Copy link
Contributor Author

sbodvanski commented Nov 16, 2022

When I download the generated sources from the guide, I can compile them in IDE and run the app as well as the tests. However, the micronaut-guides CI build is failing because of:

Executing 'micronaut-jms-aws-sqs-maven-java' tests
Error:  COMPILATION ERROR : 
Error:  /home/runner/work/micronaut-guides/micronaut-guides/build/code/micronaut-jms-aws-sqs/micronaut-jms-aws-sqs-maven-java/src/main/java/example/micronaut/SqsClientFactory.java:[3,29] package com.amazonaws.regions does not exist
Error:  Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project micronautguide: Compilation failure
Error:  /home/runner/work/micronaut-guides/micronaut-guides/build/code/micronaut-jms-aws-sqs/micronaut-jms-aws-sqs-maven-java/src/main/java/example/micronaut/SqsClientFactory.java:[3,29] package com.amazonaws.regions does not exist

Not sure what I have missed here. The missing package referred to in the compilation error above is from the com.amazonaws:aws-java-sdk-core library. I've found that it has been already added here: https://github.com/micronaut-projects/micronaut-guides/blob/master/buildSrc/src/main/resources/pom.xml#L21.

Do I need to introduce this lib or reintroduce as part of the new feature in the 'buildSrc/src/main/java/io/micronaut/guides/feature' ?

@alvarosanchez
Copy link
Member

That pom.xml is only for having automatically upgradeable dependency versions, but it alone won't make it part of the generated build

@sbodvanski
Copy link
Contributor Author

sbodvanski commented Nov 17, 2022

Have an additional question regarding the micronaut-guides test sources compile task. Not sure why compile fails for Kotlin with the following error:

Error:  Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.6.10:test-compile (test-compile) on project micronautguide: Compilation failure: Compilation failure: 

Error:  /home/runner/work/micronaut-guides/micronaut-guides/build/code/micronaut-jms-aws-sqs/micronaut-jms-aws-sqs-maven-kotlin/src/test/kotlin/example/micronaut/MicronautguideTest.kt:[38,16] Unresolved reference: LocalStack
Error:  /home/runner/work/micronaut-guides/micronaut-guides/build/code/micronaut-jms-aws-sqs/micronaut-jms-aws-sqs-maven-kotlin/src/test/kotlin/example/micronaut/MicronautguideTest.kt:[43,9] Unresolved reference: LocalStack

What did I overlook here?

The same approach having groovy test source folder as well as java test source folder, which contains the LocalStack common helper class works for the Groovy task.

@@ -26,6 +26,6 @@ public void processSelectedFeatures(FeatureContext featureContext) {
@Override
public void apply(GeneratorContext generatorContext) {
super.apply(generatorContext);
addDependency(generatorContext, "aws-java-sdk-core", Scope.TEST);
addDependency(generatorContext, "aws-java-sdk-core");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise the ci build was failing with the compilation error:

Executing 'micronaut-jms-aws-sqs-maven-java' tests
Error:  COMPILATION ERROR : 
Error:  /home/runner/work/micronaut-guides/micronaut-guides/build/code/micronaut-jms-aws-sqs/micronaut-jms-aws-sqs-maven-java/src/main/java/example/micronaut/SqsClientFactory.java:[3,29] package com.amazonaws.regions does not exist
Error:  Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project micronautguide: Compilation failure
Error:  /home/runner/work/micronaut-guides/micronaut-guides/build/code/micronaut-jms-aws-sqs/micronaut-jms-aws-sqs-maven-java/src/main/java/example/micronaut/SqsClientFactory.java:[3,29] package com.amazonaws.regions does not exist 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be necessary. This will add local stack to the main classpath.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, It does not add the localstack dependency to the main classpath, it just changes the scope of the aws-java-sdk-core dependency. There are no issues when the demo source is generated and imported to IDE.
However, when I revert the change, the problem occurs during the micronut-guide project build. Tests cannot be compiled because aws-java-sdk-core artifacts are missing.

@sdelamo what do you suggest?

@alvarosanchez
Copy link
Member

@sbodvanski please click on "Resolve conversation" for the feedback items that you already addressed, otherwise it's impossible for reviewers to tell what is done and what is still pending

@sbodvanski
Copy link
Contributor Author

@sbodvanski please click on "Resolve conversation" for the feedback items that you already addressed, otherwise it's impossible for reviewers to tell what is done and what is still pending

Will do. Thank you for pointing it out.

@graemerocher graemerocher requested a review from sdelamo November 23, 2022 08:56
guides/micronaut-jms-aws-sqs/micronaut-jms-aws-sqs.adoc Outdated Show resolved Hide resolved
"authors": ["Slavko Bodvanski"],
"tags": ["jms", "messaging", "aws"],
"categories": ["Messaging"],
"maximumJavaVersion": 16,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why fix maximumJavaVersion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until we add a new module to micronaut-jms to support Java AWS SDK v2's, it seems that we are limited to Java version below 17:
https://github.com/aws/aws-sdk-java#maintenance-and-support-for-java-versions

@@ -26,6 +26,6 @@ public void processSelectedFeatures(FeatureContext featureContext) {
@Override
public void apply(GeneratorContext generatorContext) {
super.apply(generatorContext);
addDependency(generatorContext, "aws-java-sdk-core", Scope.TEST);
addDependency(generatorContext, "aws-java-sdk-core");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be necessary. This will add local stack to the main classpath.

guides/micronaut-jms-aws-sqs/metadata.json Outdated Show resolved Hide resolved
@sbodvanski sbodvanski requested a review from sdelamo November 25, 2022 14:25
@sdelamo sdelamo merged commit ebfedcd into master Nov 28, 2022
@sdelamo sdelamo deleted the guide-micronaut-jms-aws-sqs branch November 28, 2022 08:05
sdelamo added a commit that referenced this pull request May 24, 2023
* Switch to use Serde for the S3 Event guide (#1138)

* Switch to use Serde for the Discovery eureka guide (#1134)

* Switch to use Serde for the Oauth client credentials auth0 guide (#1133)

* Switch to use Serde for the Discovery consul guide (#1135)

* Use the correct version for the micronaut-data processor with SpringBoot (#1164)

We were using the version of Micronaut, which is incorrect

* Guide: Connect a Micronaut JMS Application to an AWS SQS Queue (#1160)

Max supported Java version by AWS SDK 1.x is 16 (https://github.com/aws/aws-sdk-java#maintenance-and-support-for-java-versions)

* add AWS SQS twitter card

* Remove references to postgres and use mysql consistently for guide (#1166)

closes #1161

* Switch to use Serde for the Mybatis data access guide (#1139)

* Switch to use Serde for the Mybatis data access guide

* Remove Creator, fix Kotlin warning

* Fixes missing section in trace guide (#1173)

* Fixes wrong callouts to WarehouseController endpoints (#1174)

* Draft guide for OCI Kubernetes

* Apply suggestions from code review

Co-authored-by: Bernard Horan <bernard.horan@oracle.com>

* Update guides to 3.7.5 (#1179)

* code review improvements add native image support

* code review improvements add native image support

* code review improvements

* code review improvements

* Build Guides with Micronaut 3.8.0 (#1157)

* Build Guides with Micronaut 3.8.0

This PR runs the guides with Micronaut 3.8.0-SNAPSHOT as a pre-release check

Removes the local localstack feature as this now exists in 3.8.0

* Add snapshot repo for snapshot versions of Micronaut

* Look up the version for the data processor

* version 3.8.0

Co-authored-by: Sergio del Amo <sergio.delamo@softamo.com>

* Remove ambiguity for Kotlin (#1182)

It couldn't work out which mathod to call as the closure had an implicit return value.

I'm not sure why this has only recently appeared...  Maybe a change to micrometer

* Fix inputs for guides with a base (#1183)

If we have a guide that declares a base project, ie:

https://github.com/micronaut-projects/micronaut-guides/blob/dd911994e0c54c068602389dbcbe08eac8bdf045/guides/micronaut-metrics-aws/metadata.json#L2

Then we were not taking the code from micronaut-metrics into account for the cache-key, so changes were not picked up when building micronaut-metrics-aws

This change adds the base directory as an input if it was set

* remove empty constructor (#1167)

* misc fixes and cleanup (#1186)

* Add R2DBC guide (#965)

* copy: change GraalVM version (#1187)

* change publication to 2023-01-04

* fix: category should be categories

* disable spring-boot-micronaut-data guide (#1185)

* Micronaut Framework 3.8.1 (#1195)

* Kotlin and Groovy versions of Micronaut Dependency Injection types (#1227)

Close #1082

* Add K8s AWS guide

* Add K8s AWS guide

* Kotlin version of JAX-RS guide (#1225)

Close #1221

* code review improvements

* Micronaut Framework 3.8.2 (#1229)

* fix java version typo (#1234)

* Mock Github Server to avoid rate limiting in HTTP Client Guide (#1236)

* build: Micronaut Framework 3.8.4

* X-API-KEY guide (#1237)

* add api key guide twitter card

* CORS guide (#1238)

* docker image guide (#1239)

* executable Jar guide to distribution category (#1240)

- enable every language. Use distributable-base

* create the http client lazyly (#1243)

* add lateinit and @field callouts (#1228)

* Custom constraint guide (#1244)

* custom constraint

* Update guides/micronaut-custom-validation-annotation/java/src/test/java/example/micronaut/ContactTest.java

* twitter card

* Fix curl command (#1248)

When copying the curl command, each new line is executed rather than waiting for the last command.

* build: Micronaut Framework 3.8.5(#1249)

* Guide: Using IntelliJ IDEA to develop Micronaut applications (#1241)

* 2023 copyright

* Micronaut Framework 3.8.6 (#1251)

* build: Micronaut Framework 3.8.7 (#1252)

* add awaitility version (#1253)

Close: #1074

* Fixes for MN Scope Types guide, mostly imports and annotations to ensure that the Tests work as intended. (#1254)

* [Error-handling Guide] Added missing dependency and a closing bracket for the BookController class. (#1260)

* Micronaut Framework 3.8.8 (#1261)

* move create your first graalvm guide to distribution category (#1256)

* Security Session Guide: Removed the extra dependency that could cause tests to fail (#1263)

* CRaC Cloud Run guide (#1259)

Close #1257

* Keycloak Guide (#586)

* add back common-google-cloud-platform.adoc snippet

accidentally deleted via #1259

* add image back

* use categories

* Micronaut Framework 3.8.9 (#1264)

* [Database JDBC Guides for AWS, Azure, and GCP] Fixed the environment variable names to be compatible with the sample JDBC application, and added explanations similar to the original JDBC guide. (#1270)

* build: Micronaut Framework 3.9.1 (#1267)

* build: Micronaut Build Plugin to 5.4.9 (#1273)

* 3.9.2 (#1280)

---------

Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Slavko <bodvanski.slavko@gmail.com>
Co-authored-by: sdelamo <sergio.delamo@softamo.com>
Co-authored-by: Dean Wette <wetted@objectcomputing.com>
Co-authored-by: Bernard Horan <bernard.horan@oracle.com>
Co-authored-by: Burt Beckwith <burt@burtbeckwith.com>
Co-authored-by: Graeme Rocher <graeme.rocher@gmail.com>
Co-authored-by: Alina Yurenko <alina.yurenko@oracle.com>
Co-authored-by: hartraft <hartraft@tutanota.com>
Co-authored-by: Long Pham <ptlitmipitu@gmail.com>
AndreaLaGrotteria pushed a commit to AndreaLaGrotteria/micronaut-guides that referenced this pull request Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants