Open sgammon opened 3 years ago
I've added a repro from a vanilla demo project here: https://github.com/sgammon/micronaut-pubsub-repro
@graemerocher / @viniciusccarvalho any ideas of what might be going wrong here?
Try debug https://github.com/micronaut-projects/micronaut-gcp/blob/0fe125a3c0feab78cbd5881f5c1eb1fb9fcb334e/gcp-pubsub/src/main/java/io/micronaut/gcp/pubsub/intercept/PubSubConsumerAdvice.java#L148 since that is where the subscriber is registered
Like @graemerocher said you can put a breakpoint there and see if it gets created. Another common issue with GCP is if you are authenticating using default credentials, Google keeps changing the IAM policies, and a bunch of services will just not work if you are not using a json credentials file and use the GOOGLE_APPLICATION_CREDENTIALS
to point to the file.
@graemerocher the breakpoint doesn't get hit
@viniciusccarvalho i don't think this is related to credentials, if only because i get no errors in TRACE mode.
i do however get this error:
Bean type interface io.micronaut.context.processor.ExecutableMethodProcessor is not compatible with candidate generic types [interface io.micronaut.gcp.pubsub.annotation.PubSubListener] of candidate Definition: io.micronaut.gcp.pubsub.intercept.PubSubConsumerAdvice
how could that possibly be the case, though?
Which version of Micronaut?
And which version of Micronaut GCP?
@graemerocher looks like it's micronaut 3.0.0, has anything changed on bean post processing? I have been AFK for a while, did not keep up, need to test the GCP support on 3.x version
@viniciusccarvalho yes that is why I asked. For Micronaut 3.0 is currently at milestone stage, you should explicitly declare a dependency on the 4.0.0 RC1 release to get a compatible version of the GCP module https://github.com/micronaut-projects/micronaut-gcp/releases/tag/v4.0.0-RC1
Somehow the javax.inject package is missing from the depedencies: implementation group: 'javax.inject', name: 'javax.inject', version: '1'
I noticed that after adding it, all gcp beans were being loaded (for instance the GoogleCredentialsFactory). You could also check that @Singleton
annotation was erroring on the IDE as the dependency is missin.
@sgammon I would follow @graemerocher advice and just change the version of your micronaut base project.
Thanks @graemerocher
@graemerocher / @viniciusccarvalho the sample is in 3.x.x
, and yes i was previously using that. downgrading to 2.5.4
gets me better TRACE
logs, but I still don't get a subscription. let me get back to you guys with more information or as soon as i determine this to be an actual bug (and not just cavalier upgrades to unreleased code!).
thank you for your help both of you 😄
Hey there Micronaut authors,
I tried to setup a Pub/Sub subscriber in Micronaut, but I'm having trouble getting it to start up and receive a signal from the subscription. Basically, here is my code (in Kotlin):
The expectation (unless I am mistaken) is that, if
CatalogPipeline
is present in the classpath and designated via the.packages(*)
call in myApplication
, Micronaut will boot up the Pub/Sub subscription and begin calling it for signals. Is that correct, or is there more setup I need to do?I also have this in my
application.yml
:The subscription is named correctly in GCP, and the project ID matches. My local credentials are authorized to publish and subscribe to the topic/subscription.
Also, how would I go about diagnosing these issues with logging? Is there a class that I can enable logging for to see why it would, or would not, create the subscription?