Skip to content

CAMEL-12665 - Apache Pulsar integration via Component - #2849

Closed
foamdino wants to merge 19 commits into
apache:camel-2.xfrom
OpenSource-THG:camel-2.x-pulsar
Closed

CAMEL-12665 - Apache Pulsar integration via Component#2849
foamdino wants to merge 19 commits into
apache:camel-2.xfrom
OpenSource-THG:camel-2.x-pulsar

Conversation

@foamdino

Copy link
Copy Markdown

Contains new camel-pulsar component and example usage camel-example-spring-pulsar.

Looking forward to feedback on design/style code quality.

@oscerd oscerd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The component must be added to the kit, the component starter seems to be missing, we may need to add a Karaf feature to support this on OSGi container and we need integration tests for Karaf and Spring Boot.
First we need to clean up everything a bit, lot of TODOs and some unused classes or empty methods etc.

Comment thread examples/camel-example-spring-pulsar/pom.xml Outdated
Comment thread parent/pom.xml Outdated
@oscerd

oscerd commented Mar 29, 2019

Copy link
Copy Markdown
Contributor

@davsclaus please have a look too :-)

import org.slf4j.LoggerFactory;

@Ignore //TODO use TestContainers to spin up local pulsar broker
public class PulsarConsumerInTest extends CamelTestSupport {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not having, single test class. This is a fast review. I may not see the reason promptly

Comment thread components/camel-pulsar/pom.xml Outdated
@oscerd

oscerd commented Apr 5, 2019

Copy link
Copy Markdown
Contributor

What's the status of this one? Once we have this finished, we need a new PR for master

@foamdino

foamdino commented Apr 5, 2019

Copy link
Copy Markdown
Author

I'm going to spend some time doing the last changes today (against this branch), then open a new PR against master when this version is finished.

@foamdino

foamdino commented Apr 9, 2019

Copy link
Copy Markdown
Author

This is now ready for another review.

Comment thread components/camel-pulsar/pom.xml Outdated

@oscerd oscerd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Only that minor comment. Probably you need to run again the profile sourcecheck and fix Codestyle

@oscerd

oscerd commented Apr 9, 2019

Copy link
Copy Markdown
Contributor

btw we have a camel-testcontainers and camel-testcontainers-spring, so you can use them instead of using the explicit dependency. There are examples, like camel-nats or camel-consul

@oscerd

oscerd commented Apr 9, 2019

Copy link
Copy Markdown
Contributor

Thanks

@foamdino

Copy link
Copy Markdown
Author

Pushed a load of checkstyle changes

@oscerd

oscerd commented Apr 10, 2019

Copy link
Copy Markdown
Contributor

We need to align the component code and example code in 2.x to what we have in master now.

@foamdino

Copy link
Copy Markdown
Author

We need to align the component code and example code in 2.x to what we have in master now.
Ok I can revert the checkstyle changes to make this closer to the version in master - obviously the changes to the package names due to the master changes will have to stay

@oscerd

oscerd commented Apr 10, 2019

Copy link
Copy Markdown
Contributor

Yes, but something is not like camel 3, for example the META-INF stuff for the component is still to be explicitly added when on 2.x, while on 3.x is just an annotation that will do the trick... So it's not an easy operation to backport from master to 2.x

private final PulsarClient pulsarClient;

PulsarComponent(CamelContext context, AutoConfiguration autoConfiguration, PulsarClient pulsarClient) {
super(context);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The constructor must be changed like on master.

@davsclaus

Copy link
Copy Markdown
Contributor

Is the persistence and non-persistence part of Apache Pulsar topic? eg it looks like you pass on this to pulsar and it knows about it.

I am asking as the endpoint uri syntax is a bit wrong and we need to tidy this up a bit. For example we may want to have an enum with those 2 values so Camel knows what you can specify which also allows tooling to know that.

And do you need that double slash in the topic name?

eg can this

persistent://public/default/camel-concurrent-producers-topic

become

persistent:public/default/camel-concurrent-producers-topic

@oscerd

oscerd commented Apr 11, 2019

Copy link
Copy Markdown
Contributor

Is the persistence and non-persistence part of Apache Pulsar topic? eg it looks like you pass on this to pulsar and it knows about it.

I am asking as the endpoint uri syntax is a bit wrong and we need to tidy this up a bit. For example we may want to have an enum with those 2 values so Camel knows what you can specify which also allows tooling to know that.

And do you need that double slash in the topic name?

eg can this

persistent://public/default/camel-concurrent-producers-topic

become

persistent:public/default/camel-concurrent-producers-topic

We can improve it for sure. On master I had to change it to persistence in uri:syntax because it breaks the adoc rendering

@davsclaus

Copy link
Copy Markdown
Contributor

Also we need to make the unit tests run when there is no docker environment, so you dont get failures.

@rshermanTHG

Copy link
Copy Markdown

Is the persistence and non-persistence part of Apache Pulsar topic? eg it looks like you pass on this to pulsar and it knows about it.
I am asking as the endpoint uri syntax is a bit wrong and we need to tidy this up a bit. For example we may want to have an enum with those 2 values so Camel knows what you can specify which also allows tooling to know that.
And do you need that double slash in the topic name?
eg can this

persistent://public/default/camel-concurrent-producers-topic

become

persistent:public/default/camel-concurrent-producers-topic

We can improve it for sure. On master I had to change it to persistence in uri:syntax because it breaks the adoc rendering

In Pulsar a topic is either persistent or non-persistent. It must include the double forward slashes after the colon when passed to pulsar i.e persistent://public/default/camel-concurrent-producers-topic

@oscerd

oscerd commented Apr 15, 2019

Copy link
Copy Markdown
Contributor

what's the status of this one?

@rshermanTHG

Copy link
Copy Markdown

We need to align the component code and example code in 2.x to what we have in master now.

Have aligned the changes done in master.

@oscerd

oscerd commented Apr 23, 2019

Copy link
Copy Markdown
Contributor

I'm working on the merge. @foamdino and @rshermanTHG can you please improve the documentation under src/main/docs on master?

@oscerd

oscerd commented Apr 23, 2019

Copy link
Copy Markdown
Contributor

The build is failing. Can you please check on 2.x?

[ERROR] Failed to execute goal org.apache.camel:camel-package-maven-plugin:2.24.0-SNAPSHOT:prepare-spring-boot-auto-configuration (validate) on project camel-pulsar: Execution validate of goal org.apache.camel:camel-package-maven-plugin:2.24.0-SNAPSHOT:prepare-spring-boot-auto-configuration failed: String index out of range: -1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.camel:camel-package-maven-plugin:2.24.0-SNAPSHOT:prepare-spring-boot-auto-configuration (validate) on project camel-pulsar: Execution validate of goal org.apache.camel:camel-package-maven-plugin:2.24.0-SNAPSHOT:prepare-spring-boot-auto-configuration failed: String index out of range: -1
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution validate of goal org.apache.camel:camel-package-maven-plugin:2.24.0-SNAPSHOT:prepare-spring-boot-auto-configuration failed: String index out of range: -1
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring (String.java:1967)
    at org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo.executeComponent (SpringBootAutoConfigurationMojo.java:592)
    at org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo.execute (SpringBootAutoConfigurationMojo.java:196)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

@oscerd

oscerd commented Apr 23, 2019

Copy link
Copy Markdown
Contributor

@davsclaus can you take a look?

@davsclaus

Copy link
Copy Markdown
Contributor

@oscerd I think I fixed something similar on master branch in that SB generator.

@davsclaus

Copy link
Copy Markdown
Contributor

okay building 2.x now

@davsclaus

Copy link
Copy Markdown
Contributor

Okay you need to be able to build the component without having docker running, so that should be fixed too.

@davsclaus

Copy link
Copy Markdown
Contributor

Okay so the src/main/resources/META-INF/services/org/apache/camel/component/pulsar file has log4j settings, instead it should be

class=org.apache.camel.component.pulsar.PulsarComponent

@davsclaus

Copy link
Copy Markdown
Contributor

@oscerd you can fix it as above ^^^

@oscerd

oscerd commented Apr 23, 2019

Copy link
Copy Markdown
Contributor

Thank you

@oscerd

oscerd commented Apr 23, 2019

Copy link
Copy Markdown
Contributor

I'll backport the Karaf feature and tests for Karaf and SB too

@oscerd

oscerd commented Apr 23, 2019

Copy link
Copy Markdown
Contributor

Backported. Thanks. Please @rshermanTHG and @foamdino take a look at the documentation under src/main/docs and improve it if you have time.

@oscerd oscerd closed this Apr 23, 2019
@rshermanTHG
rshermanTHG deleted the camel-2.x-pulsar branch April 26, 2019 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants