Repository navigation
Step 8 - Where are the rx... methods? #19
Description
Activity
Okay, so it's produced by the code gen plugin. I don't recall that being mentioned in the guide and it's very confusing. Perhaps it would be possible to elaborate, such as how it knows to prefix the methods with rx and what the role of the
@VertGenand@GenIgnoreannotations are?this is explained in the rx documentation, the doc should indeed elaborate about it and point to the rx doc
The only mention of code generation in the Rx documentation is that the Vert.x rxified API is code generated. It doesn't explain that this is how rx service proxies should be produced, why the
createProxymethod needs to haverxjava(orreactivex) in its package name, nor what annotations are needed. It also requires picking through the codegen documentation.This is the sort of thing I personally consider as an essential explanation in a guide, picking up where package documentation leaves off. Up until step-8, it's spot on and very good at explaining what is going on and how different elements of the Vert.x ecosystem interoperates, then it just kind of drops off.
I know all of these things take time, and I'm very grateful for the hard work that has been put into this guide so far.
Reacted by Daniel Rauf and rsipplAdding
<classifier>processor</classifier>to thevertx-service-proxydependency in pom.xml seems to fix the code generation. Without this, I'm getting this error:java.lang.Error: Unresolved compilation problems: The import io.vertx.guides.wiki.database.reactivex cannot be resolvedActually I was wrong, I'm getting the error above in step 8 regardless of the classifier setting. If I'm running
mvn clean mvn packageeverything seems fine. If I'm running it again, the test phase fails. Basically, it fails every second time I run the above, this happens because
mvn cleandoesn't work as expected. The first invocation ofmvn cleanremoves just the generated classes, i.e. the .java files in src/main/generated, and the corresponding .class files, plus the jar files from the target dir, leaving the other class files in that same dir. A subsequent build doesn't detect the missing files, presumably becauseuseIncrementalCompilationis set to false, and the tests fail because of missing classes. After that, amvn cleanremoves the target dir completely (I don't get why).There are three fixes:
- remove the whole
maven-clean-pluginplugin section from pom.xml (but then amvn cleanwon't delete the generated .java files anymore) - add
${project.basedir}/targetto themaven-clean-pluginsection - set useIncrementalCompilation to true
To me, 2. seems best because it leads to the expected behavior on
mvn clean: run both the generated classes and the target dir.- remove the whole
In Step 8, introducing RxJava the code examples refer to various methods such as
rxDeletePage(id), yet there are no methods beginning with rx in theWikiDatabaseServiceverticle.The
Implclass has rxified the method contents, but then the signatures don't match with what is being called inHttpServerVerticleand I get errors to that extent (namely, complaints at the lack of result handler).There is also reference to
io.vertx.guides.wiki.database.rxjava.WikDatabaseServiceas the return type ofcreateProxy(), yet this package does not exist in the example.Have I missed something here? Or could you provide some clarification? Are there any plans to update this to RxJava2?