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

Reactive Messaging codestart #21068

Closed
wants to merge 3 commits into from
Closed

Conversation

vgallet
Copy link
Contributor

@vgallet vgallet commented Oct 28, 2021

@quarkus-bot
Copy link

quarkus-bot bot commented Oct 28, 2021

Thanks for your pull request!

The title of your pull request does not follow our editorial rules. Could you have a look?

  • title should not contain an issue number (use Fix #1234 in the description instead)

This message is automatically generated by a bot.

@quarkus-bot quarkus-bot bot added the area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins label Oct 28, 2021
@vgallet vgallet changed the title Reactive Messaging codestart #20872 Reactive Messaging codestart Oct 28, 2021
@vgallet
Copy link
Contributor Author

vgallet commented Oct 28, 2021

@ia3andy @ozangunalp

@ia3andy
Copy link
Contributor

ia3andy commented Oct 28, 2021

@vgallet
The code looks great.

You will need to add:

  • The dynamic connector app config depending on selected extensions (I can help if needed)
  • The tests
  • Linking the different connector extensions (in the metadata)
  • Kotlin (but that can be in another commit/PR)

@vgallet
Copy link
Contributor Author

vgallet commented Oct 28, 2021

@ia3andy

The dynamic connector app config depending on selected extensions (I can help if needed)
Linking the different connector extensions (in the metadata)

My bad, I wasn't aware codestart could dynamic depending on the selected connector, I thought created a codestart per connector implementation. Can you show me some documentation or an example to do that ?

@vgallet vgallet marked this pull request as draft October 28, 2021 15:00
@ozangunalp ozangunalp self-requested a review October 28, 2021 15:19
@ozangunalp
Copy link
Contributor

For the dynamic config depending on the connector, I guess you'll need to do some Qute templating.
You can get inspiration from the Resteasy codestart : quarkus/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-reactive-codestart/codestart.yml

For the code of MyReactiveMessagingApplication, you have currently 2 channels source and uppercase both having inbound and outbound ends connected to each other.
That would work in-memory (without any connectors) but if we want to connect them to messaging backends via connectors we'll need to change the names of some of the channels (Two channels can't have the same name).

For example:
@Channel("source-out") Emitter -> outgoing connector
@Incoming("source") <- incoming connector
@Outgoing("uppercase-out") -> outgoing connector
@Incoming("uppercase") <- incoming connector

That would mean configuring 4 connectors inside application.properties. (In the near future if only one connector is available we'll configure them automatically)

Also, we can name the class according to the connector {Kafka, AMQP, RabbitMQ, etc}ReactiveMessagingApplication.

@vgallet
Copy link
Contributor Author

vgallet commented Oct 31, 2021

@ia3andy @ozangunalp

Please can you take a look at this draft and how I created a dynamic application.yml. I also put some TODO into the code to show what's missing or if it's necessary to have it.

Copy link
Contributor

@ia3andy ia3andy left a comment

Choose a reason for hiding this comment

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

You also need to add the QuarkusCodestartTest, it will also help you make sure it works fine.

@vgallet
Copy link
Contributor Author

vgallet commented Nov 15, 2021

@ia3andy @ozangunalp Hi,

I fixed your comments and added an integration test. Nevertheless, I added three TODO as I'm stuck to make it work and make it right :

Thanks for you help

@ia3andy
Copy link
Contributor

ia3andy commented Nov 15, 2021

I will check it out to give it a try and see what's wrong.

@ia3andy
Copy link
Contributor

ia3andy commented Nov 15, 2021

Ok, I've checked with @mkouba, we can't have a counter in the loop. I think we should not comment (until we find a proper way), the multi-connectors case is an edge case.

I will have another look tomorrow morning with a bit more time, let's wait until then..

@ia3andy
Copy link
Contributor

ia3andy commented Nov 16, 2021

Hey @vgallet, I prepared a commit with the fixes to make it work:
ia3andy@d9b66a8

I had to improve a bit the test framework to avoid conflicts between the different tests..

Let me know if you want me to push it to your branch directly..

@ia3andy
Copy link
Contributor

ia3andy commented Nov 16, 2021

I had to re-commit due to a problem: ia3andy@d9b66a8

@quarkus-bot quarkus-bot bot added the area/platform Issues related to definition and interaction with Quarkus Platform label Nov 16, 2021
@vgallet vgallet marked this pull request as ready for review November 16, 2021 10:42
Copy link
Contributor

@ia3andy ia3andy left a comment

Choose a reason for hiding this comment

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

LGTM

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 16, 2021

This workflow status is outdated as a new workflow run has been triggered.

🚫 This workflow run has been cancelled.

✖ This workflow run has failed but no jobs reported an error. Something weird happened, please check the workflow run page carefully: it might be an issue with the workflow configuration itself.

@ozangunalp
Copy link
Contributor

@ia3andy would you know how to test codestarts in local?

@ia3andy
Copy link
Contributor

ia3andy commented Nov 16, 2021

@ozangunalp, you can either use the tests, or the CLI:
https://quarkus.io/version/main/guides/extension-codestart#generating

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 17, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building d83c72f

Status Name Step Failures Logs Raw logs
Initial JDK 11 Build Build Failures Logs Raw logs

Failures

⚙️ Initial JDK 11 Build #

- Failing: integration-tests/devtools 

📦 integration-tests/devtools

Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.17.0:validate (default) on project quarkus-integration-test-devtools: File '/home/runner/work/quarkus/quarkus/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/ReactiveMessagingCodestartIT.java' has not been previously formatted. Please format file and commit before running validation!

@ia3andy
Copy link
Contributor

ia3andy commented Nov 17, 2021

@vgallet could you run mvn process-sources and push?

 * fix quarkusio#20872
 * created `MyReactiveMessagingApplication` to demonstrates `@Emitter`, `@Incoming` and `@Outgoing` annotations.
 * created dynamic application.yml based on selected extension
 * added codestart integration test
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 17, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building c64c335

Status Name Step Failures Logs Raw logs
Devtools Tests - JDK 11 Build Failures Logs Raw logs
Devtools Tests - JDK 11 Windows Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Devtools Tests - JDK 11 #

- Failing: integration-tests/devtools 

📦 integration-tests/devtools

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testGradle(String)[1] line 78 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testRunTogetherCodestartsJava line 61 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testGradleKotlinDSL(String)[1] line 85 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testGradle(String)[1] line 78 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testRunTogetherCodestartsJava line 61 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testGradleKotlinDSL(String)[1] line 85 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

⚙️ Devtools Tests - JDK 11 Windows #

- Failing: integration-tests/devtools 

📦 integration-tests/devtools

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testGradle(String)[1] line 78 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testRunTogetherCodestartsJava line 61 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testGradleKotlinDSL(String)[1] line 85 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.ReactiveMessagingCodestartIT.buildAll line 50 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 
[Run project return status is zero] 
expected: 0

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testGradle(String)[1] line 78 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testRunTogetherCodestartsJava line 61 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartBuildIT.testGradleKotlinDSL(String)[1] line 85 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

expected: 0

io.quarkus.devtools.codestarts.quarkus.ReactiveMessagingCodestartIT.buildAll line 50 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 
[Run project return status is zero] 
expected: 0

📦 integration-tests/devtools/target/quarkus-codestart-test/1637140781243/real-data/java

ilove.quark.us.MyReactiveMessagingApplicationTest.test - More details - Source on GitHub

java.lang.RuntimeException: 
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.kafka.client.deployment.DevServicesKafkaProcessor#startKafkaDevService threw an exception: java.lang.RuntimeException: java.lang.IllegalStateException: Previous attempts to find a Docker environment failed. Will not retry. Please see logs and check configuration

@vgallet
Copy link
Contributor Author

vgallet commented Nov 25, 2021

Hello guys @ia3andy @ozangunalp! I discussed with @loicmathieu about the failing tests and he suggested me to split the test ReactiveMessagingCodestartIT into three tests, each dedicated per extension. WDYT ?

BTW, it misses the annotation @EnabledIfSystemProperty(named = "build-projects", matches = "true") on the test ReactiveMessagingCodestartIT#buildAll ?

@ia3andy
Copy link
Contributor

ia3andy commented Nov 25, 2021

Hello guys @ia3andy @ozangunalp! I discussed with @loicmathieu about the failing tests and he suggested me to split the test ReactiveMessagingCodestartIT into three tests, each dedicated per extension. WDYT ?

I will try to run the tests locally to see what's going on. I don't think we need to split.

BTW, it misses the annotation @EnabledIfSystemProperty(named = "build-projects", matches = "true") on the test ReactiveMessagingCodestartIT#buildAll ?

You don't need it, it your case you want that test to be run.

@ia3andy
Copy link
Contributor

ia3andy commented Nov 25, 2021

I pushed fixes, let see what the CI has to say to it :)

If it's green, could you squash it all? Thanks @vgallet ✌️

@ia3andy
Copy link
Contributor

ia3andy commented Nov 25, 2021

Ok the tests are failing because there is no docker environment on CI for the devservices to be started :-/ I am not sure what's the way forward..

@ia3andy
Copy link
Contributor

ia3andy commented Nov 25, 2021

It's weird that the same test is only failing on windows:

Error: ]: Build step io.quarkus.kafka.client.deployment.DevServicesKafkaProcessor#startKafkaDevService threw an exception: java.lang.RuntimeException: java.lang.IllegalStateException: Previous attempts to find a Docker environment failed. Will not retry. Please see logs and check configuration
	at io.quarkus.kafka.client.deployment.DevServicesKafkaProcessor.startKafkaDevService(DevServicesKafkaProcessor.java:116)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.lang.IllegalStateException: Previous attempts to find a Docker environment failed. Will not retry. Please see logs and check configuration
	at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:114)

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 25, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building 4bae693

Status Name Step Failures Logs Raw logs
Devtools Tests - JDK 11 Windows Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Devtools Tests - JDK 11 Windows #

- Failing: integration-tests/devtools 

📦 integration-tests/devtools

io.quarkus.devtools.codestarts.quarkus.ReactiveMessagingCodestartIT.buildAll line 50 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 
[Run project return status is zero] 
expected: 0

io.quarkus.devtools.codestarts.quarkus.ReactiveMessagingCodestartIT.buildAll line 50 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 
[Run project return status is zero] 
expected: 0

📦 integration-tests/devtools/target/quarkus-codestart-test/quarkus-smallrye-reactive-messaging-kafka-cb1a4d5c-075b-450f-a3c5-1eb4ea471a6a/real-data/java

ilove.quark.us.MyReactiveMessagingApplicationTest.test - More details - Source on GitHub

java.lang.RuntimeException: 
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.kafka.client.deployment.DevServicesKafkaProcessor#startKafkaDevService threw an exception: java.lang.RuntimeException: java.lang.IllegalStateException: Previous attempts to find a Docker environment failed. Will not retry. Please see logs and check configuration

@ia3andy
Copy link
Contributor

ia3andy commented Nov 26, 2021

@cescoffier do you know why this test is not working on Windows?

@cescoffier
Copy link
Member

Nope, it should not spend on the OS

@loicmathieu
Copy link
Contributor

@ia3andy Windows CI didn't have Docker, all IT that needs Docker are not run inside the Windows job.

@ia3andy
Copy link
Contributor

ia3andy commented Nov 26, 2021

Should we disable this build test on Windows then?
Or maybe we should disable the MyReactiveMessagingApplicationTest on Windows?

@loicmathieu
Copy link
Contributor

As far as I know, all test that requires Docker are disabled in the CI.

@ia3andy
Copy link
Contributor

ia3andy commented Dec 1, 2021

Ok what do we suggest users in that matter? Maybe we should disable this test directly in the template so that users know it doesn't work on Windows? The problem is not related to the codestart test but more the generated project IMO.

@ia3andy
Copy link
Contributor

ia3andy commented Dec 1, 2021

@cescoffier what is our best practice for users regarding dev services using docker and Windows?

@loicmathieu
Copy link
Contributor

@ia3andy Devservices works on Windows, I use them everyday.

But our Windows CI runner didn't have Docker so you must disabled the test via @DisableOnOs(OS.WINDOWS)

@ia3andy
Copy link
Contributor

ia3andy commented Dec 1, 2021

@DisableOnOs(OS.WINDOWS)

Thanks, I'll add this then :)

@quarkus-bot
Copy link

quarkus-bot bot commented Dec 1, 2021

Failing Jobs - Building eca87b6

Status Name Step Failures Logs Raw logs
Devtools Tests - JDK 11 Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Devtools Tests - JDK 11 #

- Failing: integration-tests/devtools 

📦 integration-tests/devtools

io.quarkus.devtools.codestarts.quarkus.ReactiveMessagingCodestartIT.buildAMQP line 65 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 
[Run project return status is zero] 
expected: 0

io.quarkus.devtools.codestarts.quarkus.ReactiveMessagingCodestartIT.buildMQTT line 59 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 
[Run project return status is zero] 
expected: 0

io.quarkus.devtools.codestarts.quarkus.ReactiveMessagingCodestartIT.buildKafka line 53 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 
[Run project return status is zero] 
expected: 0

io.quarkus.devtools.codestarts.quarkus.ReactiveMessagingCodestartIT.buildAMQP line 65 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 
[Run project return status is zero] 
expected: 0

io.quarkus.devtools.codestarts.quarkus.ReactiveMessagingCodestartIT.buildMQTT line 59 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 
[Run project return status is zero] 
expected: 0

io.quarkus.devtools.codestarts.quarkus.ReactiveMessagingCodestartIT.buildKafka line 53 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 
[Run project return status is zero] 
expected: 0

@ia3andy
Copy link
Contributor

ia3andy commented Dec 1, 2021

@famod any idea why we don't run devtools tests also on JDK 17

@ia3andy
Copy link
Contributor

ia3andy commented Dec 2, 2021

I've found the problem and fixed it on my branch, @vgallet could you rebase from main so I can apply it?

@famod
Copy link
Member

famod commented Dec 2, 2021

@ia3andy

@famod any idea why we don't run devtools tests also on JDK 17

Well, there simply wasn't a Java 16 job when I updated to 17. See also: #21481 (comment)

CI has so many jobs already, but as devtools ITs "only" take ~30m I think this could be added.

cc @gsmet

@ia3andy
Copy link
Contributor

ia3andy commented Dec 3, 2021

I am closing this one to be able to rebase and test with the CI (I am keeping you @vgallet as author): #21906

@ia3andy ia3andy closed this Dec 3, 2021
@quarkus-bot quarkus-bot bot added the triage/invalid This doesn't seem right label Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform area/reactive-messaging area/smallrye triage/invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reactive Messaging codestart (in java and kotlin)
6 participants