eclipse / lsp4mp

Technology lsp4mp
Eclipse Public License 2.0
22 stars 27 forks source link

How to extend validation options for "Reactive Messaging for MicroProfile" connector ? #439

Open scottkurz opened 6 months ago

scottkurz commented 6 months ago

In https://github.com/OpenLiberty/liberty-tools-eclipse/issues/500, we see an issue validating an MP config property: mp.messaging.outgoing.systemLoad.connector=liberty-kafka

with description: Invalid enum value: 'liberty-kafka' is invalid for type org.eclipse.microprofile.reactive.messaging.spi.Connector

This is LSP4MP version 0.10.0.

Would you envision adding a new option here to the core LSP4MP? An extension (or as part of the "client" pulling in LSP4MP) ?

Figured I'd just ask and see your first response before thinking too hard myself. Thank you.

fbricon commented 6 months ago

please attach a sample project reproducing the issue.

I can't tell at this point if this requires extending lsp4mp or if relaxing lsp4mp validation is a better approach. @angelozerr?

scottkurz commented 6 months ago

Thanks. To recreate:

  1. Install Eclipse for Java package: 2023-12
  2. Install Liberty Tools Eclipse 23.0.12 (latest currently in Eclipse Marketplace https://marketplace.eclipse.org/content/liberty-tools)
  3. git clone git@github.com:openliberty/guide-microprofile-reactive-messaging.git
  4. Do a mvn import guide-microprofile-reactive-messaging/finish and child projects into Eclipse
  5. Open system/src/main/resources/META-INF/microprofile-config.properties
angelozerr commented 6 months ago

I can't tell at this point if this requires extending lsp4mp or if relaxing lsp4mp validation is a better approach. @angelozerr?

I dont remember how this validation is working. I need to find time to understand again how it works.

angelozerr commented 2 months ago

@scottkurz the liberty-kafka should be retrieved from https://github.com/OpenLiberty/open-liberty/blob/912749d6fee4cc44047d0841dda9897f5c2837df/dev/com.ibm.ws.microprofile.reactive.messaging.kafka/src/com/ibm/ws/microprofile/reactive/messaging/kafka/KafkaOutgoingConnector.java#L44

I have imported your project and KafkaOutgoingConnector is not in the classpath, perhaps it misses a dependency in your pom.xml?

scottkurz commented 2 months ago

Thank you @angelozerr for explaining that. I see what you're saying. This is just a String in a properties file, so it's not required to compile or at runtime... but the validation needs to see it on the classpath to validate it.

I still wonder if maybe the validation is too strict or needs to be adjusted, but I'm not arguing that yet. Let me first see what the pom.xml would look like. Thanks

angelozerr commented 2 months ago

If you start the project is it working?

I dont understand how it can work if it misses the liberty kafka connector on the classpath

scottkurz commented 2 months ago

I dont understand how it can work if it misses the liberty kafka connector on the classpath

Within Liberty there's a different classloader structure than the one built by Maven.

angelozerr commented 2 months ago

To fix your issue, your liberty tooling will need to add an extension to add this missing properties like we did with Quarkus LS JDT extension https://github.com/redhat-developer/quarkus-ls/tree/master/quarkus.jdt.ext which add Quarkus deploiement in classpath when properties are collected (see https://github.com/search?q=repo%3Aredhat-developer%2Fquarkus-ls%20deployment&type=code)

Your extension could: