-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add support for reactive PubSub consumers #958
Conversation
Support for reactive consumers is added. This gives the ability to bind the received PubSub message as a reactive type to the subscriber method's body parameter, and to return a reactive type to which the framework will subscribe. Message automatic and manual ack/nack are handled accordingly. Docs are added for the added reactive support. This resolves issue #945
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Some really nitpicky typographical suggestions (license year, avoid tabs, wildcard imports and kotlinification suggestion)
gcp-pubsub/src/main/java/io/micronaut/gcp/pubsub/intercept/PubSubConsumerAdvice.java
Outdated
Show resolved
Hide resolved
test-suite-kotlin/src/main/kotlin/io/micronaut/gcp/pubsub/subscriber/ReactiveSubscriber.kt
Outdated
Show resolved
Hide resolved
test-suite-kotlin/src/main/kotlin/io/micronaut/gcp/pubsub/subscriber/ReactiveSubscriber.kt
Outdated
Show resolved
Hide resolved
test-suite-kotlin/src/main/kotlin/io/micronaut/gcp/pubsub/subscriber/ReactiveSubscriber.kt
Outdated
Show resolved
Hide resolved
test-suite-kotlin/src/main/kotlin/io/micronaut/gcp/pubsub/subscriber/ReactiveSubscriber.kt
Outdated
Show resolved
Hide resolved
...suite-kotlin/src/main/kotlin/io/micronaut/gcp/pubsub/subscriber/AcknowledgementSubscriber.kt
Outdated
Show resolved
Hide resolved
...suite-kotlin/src/main/kotlin/io/micronaut/gcp/pubsub/subscriber/AcknowledgementSubscriber.kt
Outdated
Show resolved
Hide resolved
test-suite/src/main/java/io/micronaut/gcp/pubsub/subscriber/ReactiveSubscriber.java
Outdated
Show resolved
Hide resolved
test-suite-kotlin/src/main/kotlin/io/micronaut/gcp/pubsub/subscriber/MessageProcessor.kt
Outdated
Show resolved
Hide resolved
test-suite-groovy/src/main/groovy/io/micronaut/gcp/pubsub/subscriber/ReactiveSubscriber.groovy
Outdated
Show resolved
Hide resolved
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Please retry analysis of this Pull-Request directly on SonarCloud. |
Co-authored-by: Tim Yates <tim.yates@gmail.com>
Co-authored-by: Tim Yates <tim.yates@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add tests to test-suite-groovy
, test-suite
and test-suite-kotlin
.
Right now the code there, which is the one shown in the docs is not tested.
gcp-pubsub/src/main/java/io/micronaut/gcp/pubsub/bind/PubSubBodyBinder.java
Outdated
Show resolved
Hide resolved
gcp-pubsub/src/main/java/io/micronaut/gcp/pubsub/bind/PubSubBodyBinder.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Sergio del Amo <sergio.delamo@softamo.com>
Tests are added to test-suite, test-suite-groovy, and test-suite-kotlin for the relevant example code for reactive PubSub consumer support. Tests are also added to verify the supported PubSub subscription method message body binding scenarios, and a fix is implemented for binding a reactive type containing an array.
@sdelamo @timyates This is ready for a re-review with the added tests. CI looks to be failing ATM because it's taking too long to download the docker image being used in the test-suite tests. I'll try to get that sorted out, but if either of you already know the potential solution to it I'd welcome your suggestions. |
@timyates please review this again |
@sdelamo I am doing. I got the test-suite passing without timing out downloading the 1GB docker image Graal is failing, and I'm not sure why...there's a discussion on Discord |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Questions about excluding listeners in the suites
But thinking about it, I guess these were not executed before as there were no tests 🤔
I removed some semi-colons, and some sonar smells in a commit
test-suite-groovy/src/main/groovy/io/micronaut/gcp/pubsub/quickstart/AnimalListener.groovy
Show resolved
Hide resolved
...oovy/src/main/groovy/io/micronaut/gcp/pubsub/subscriber/CustomConfigurationSubscriber.groovy
Show resolved
Hide resolved
...uite-groovy/src/main/groovy/io/micronaut/gcp/pubsub/subscriber/CustomHeaderSubscriber.groovy
Show resolved
Hide resolved
test-suite-groovy/src/main/groovy/io/micronaut/gcp/pubsub/subscriber/SimpleSubscriber.groovy
Show resolved
Hide resolved
@timyates Thanks for the assist! Any ideas about the Graal error that's happening now? As for the disabled beans, you are correct that those classes were never being executed prior. In all cases I had to disable them because the PubSub topics they are trying to subscribe to either haven't been configured to exist in the docker container yet, or they overlap with the listeners that are now being tested (can't have multiple methods for the same subscription). |
There's a thread in discord, Graeme says it's being investigated |
SonarCloud Quality Gate failed. 0 Bugs 37.6% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Support for reactive consumers is added. This gives the ability to bind the received PubSub message as a reactive type
to the subscriber method's body parameter, and to return a reactive type to which the
framework will subscribe.
Message automatic and manual ack/nack are handled accordingly.
Docs are added for the added reactive support.
This resolves issue #945