This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push: new 17b064a Add Google Pubsub extension (JVM only) 17b064a is described below commit 17b064ab6ff5c0ab1265048cf2d280c7cd6de69e Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Wed Mar 25 14:53:15 2020 +0000 Add Google Pubsub extension (JVM only) Fixes #808 --- .../pages/list-of-camel-quarkus-extensions.adoc | 6 +- extensions-jvm/google-pubsub/deployment/pom.xml | 75 +++++++++++++++++ .../pubsub/deployment/GooglePubsubProcessor.java | 46 +++++++++++ .../google-pubsub/integration-test/pom.xml | 94 ++++++++++++++++++++++ .../google/pubsub/it/GooglePubsubResource.java | 51 ++++++++++++ .../google/pubsub/it/GooglePubsubTest.java | 33 ++++++++ extensions-jvm/google-pubsub/pom.xml | 40 +++++++++ extensions-jvm/google-pubsub/runtime/pom.xml | 83 +++++++++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 28 +++++++ extensions-jvm/pom.xml | 1 + poms/bom-deployment/pom.xml | 5 ++ poms/bom/pom.xml | 10 +++ 12 files changed, 471 insertions(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc index b2c2c00..032be73 100644 --- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc +++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc @@ -18,7 +18,7 @@ In case you are missing some Camel feature in the list: == Camel Components // components: START -Number of Camel components: 144 in 109 JAR artifacts (0 deprecated) +Number of Camel components: 145 in 110 JAR artifacts (0 deprecated) [width="100%",cols="4,1,1,5",options="header"] |=== @@ -293,6 +293,10 @@ Level | Since | Description `google-mail-stream:index` | Native + Stable | 1.0.0-M6 | The google-mail component provides access to Google Mail. +| link:https://camel.apache.org/components/latest/google-pubsub-component.html[Google Pubsub] (camel-quarkus-google-pubsub) + +`google-pubsub:projectId:destinationName` | JVM + + Preview | 1.0.0-M6 | Messaging client for Google Cloud Platform PubSub Service + | link:https://camel.apache.org/components/latest/google-sheets-component.html[Google Sheets] (camel-quarkus-google-sheets) + `google-sheets:apiName/methodName` | Native + Stable | 1.0.0-M6 | The google-sheets component provides access to Google Sheets. diff --git a/extensions-jvm/google-pubsub/deployment/pom.xml b/extensions-jvm/google-pubsub/deployment/pom.xml new file mode 100644 index 0000000..1f88a12 --- /dev/null +++ b/extensions-jvm/google-pubsub/deployment/pom.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-google-pubsub-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-google-pubsub-deployment</artifactId> + <name>Camel Quarkus :: Google Pubsub :: Deployment</name> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-google-pubsub</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/extensions-jvm/google-pubsub/deployment/src/main/java/org/apache/camel/quarkus/component/google/pubsub/deployment/GooglePubsubProcessor.java b/extensions-jvm/google-pubsub/deployment/src/main/java/org/apache/camel/quarkus/component/google/pubsub/deployment/GooglePubsubProcessor.java new file mode 100644 index 0000000..40fea4d --- /dev/null +++ b/extensions-jvm/google-pubsub/deployment/src/main/java/org/apache/camel/quarkus/component/google/pubsub/deployment/GooglePubsubProcessor.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.google.pubsub.deployment; + +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.annotations.ExecutionTime; +import io.quarkus.deployment.annotations.Record; +import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.deployment.pkg.steps.NativeBuild; +import org.apache.camel.quarkus.core.JvmOnlyRecorder; +import org.jboss.logging.Logger; + +class GooglePubsubProcessor { + + private static final Logger LOG = Logger.getLogger(GooglePubsubProcessor.class); + private static final String FEATURE = "camel-google-pubsub"; + + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } + + /** + * Remove this once this extension starts supporting the native mode. + */ + @BuildStep(onlyIf = NativeBuild.class) + @Record(value = ExecutionTime.RUNTIME_INIT) + void warnJvmInNative(JvmOnlyRecorder recorder) { + JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time + recorder.warnJvmInNative(FEATURE); // warn at runtime + } +} diff --git a/extensions-jvm/google-pubsub/integration-test/pom.xml b/extensions-jvm/google-pubsub/integration-test/pom.xml new file mode 100644 index 0000000..7cc915a --- /dev/null +++ b/extensions-jvm/google-pubsub/integration-test/pom.xml @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-google-pubsub-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-quarkus-google-pubsub-integration-test</artifactId> + <name>Camel Quarkus :: Google Pubsub :: Integration Test</name> + <description>Integration tests for Camel Quarkus Google Pubsub extension</description> + + <properties> + <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd --> + <!-- The following rule tells mvnd to build the listed deployment modules before this module. --> + <!-- This is important because mvnd builds modules in parallel by default. The deployment modules are not --> + <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. --> + <!-- Please update rule whenever you change the dependencies of this module by running --> + <!-- mvn process-resources -Pformat from the root directory --> + <mvnd.builder.rule>camel-quarkus-google-pubsub-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom-test</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-google-pubsub</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</artifactId> + </dependency> + + <!-- test dependencies --> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>rest-assured</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>build</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/extensions-jvm/google-pubsub/integration-test/src/main/java/org/apache/camel/quarkus/component/google/pubsub/it/GooglePubsubResource.java b/extensions-jvm/google-pubsub/integration-test/src/main/java/org/apache/camel/quarkus/component/google/pubsub/it/GooglePubsubResource.java new file mode 100644 index 0000000..39aa2f3 --- /dev/null +++ b/extensions-jvm/google-pubsub/integration-test/src/main/java/org/apache/camel/quarkus/component/google/pubsub/it/GooglePubsubResource.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.google.pubsub.it; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.apache.camel.CamelContext; +import org.jboss.logging.Logger; + +@Path("/google-pubsub") +@ApplicationScoped +public class GooglePubsubResource { + + private static final Logger LOG = Logger.getLogger(GooglePubsubResource.class); + + private static final String COMPONENT_GOOGLE_PUBSUB = "google-pubsub"; + @Inject + CamelContext context; + + @Path("/load/component/google-pubsub") + @GET + @Produces(MediaType.TEXT_PLAIN) + public Response loadComponentGooglePubsub() throws Exception { + /* This is an autogenerated test */ + if (context.getComponent(COMPONENT_GOOGLE_PUBSUB) != null) { + return Response.ok().build(); + } + LOG.warnf("Could not load [%s] from the Camel context", COMPONENT_GOOGLE_PUBSUB); + return Response.status(500, COMPONENT_GOOGLE_PUBSUB + " could not be loaded from the Camel context").build(); + } +} diff --git a/extensions-jvm/google-pubsub/integration-test/src/test/java/org/apache/camel/quarkus/component/google/pubsub/it/GooglePubsubTest.java b/extensions-jvm/google-pubsub/integration-test/src/test/java/org/apache/camel/quarkus/component/google/pubsub/it/GooglePubsubTest.java new file mode 100644 index 0000000..9987659 --- /dev/null +++ b/extensions-jvm/google-pubsub/integration-test/src/test/java/org/apache/camel/quarkus/component/google/pubsub/it/GooglePubsubTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.google.pubsub.it; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import org.junit.jupiter.api.Test; + +@QuarkusTest +class GooglePubsubTest { + + @Test + public void loadComponentGooglePubsub() { + RestAssured.get("/google-pubsub/load/component/google-pubsub") + .then() + .statusCode(200); + } + +} diff --git a/extensions-jvm/google-pubsub/pom.xml b/extensions-jvm/google-pubsub/pom.xml new file mode 100644 index 0000000..760b841 --- /dev/null +++ b/extensions-jvm/google-pubsub/pom.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-build-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-google-pubsub-parent</artifactId> + <name>Camel Quarkus :: Google Pubsub</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + <module>integration-test</module> + </modules> +</project> diff --git a/extensions-jvm/google-pubsub/runtime/pom.xml b/extensions-jvm/google-pubsub/runtime/pom.xml new file mode 100644 index 0000000..42f9b54 --- /dev/null +++ b/extensions-jvm/google-pubsub/runtime/pom.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-google-pubsub-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-google-pubsub</artifactId> + <name>Camel Quarkus :: Google Pubsub :: Runtime</name> + <description>Messaging client for Google Cloud Platform PubSub Service</description> + + <properties> + <firstVersion>1.0.0-M6</firstVersion> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-google-pubsub</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-bootstrap-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/extensions-jvm/google-pubsub/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-jvm/google-pubsub/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..420dacf --- /dev/null +++ b/extensions-jvm/google-pubsub/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,28 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- +name: "Google Pubsub" +description: "Messaging client for Google Cloud Platform PubSub Service" +metadata: + unlisted: true + keywords: + - "messaging" + guide: "https://camel.apache.org/components/latest/google-pubsub-component.html" + categories: + - "integration" + status: "preview" diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml index f0c16ed..e268ad7 100644 --- a/extensions-jvm/pom.xml +++ b/extensions-jvm/pom.xml @@ -59,6 +59,7 @@ <module>debezium-sqlserver</module> <module>elasticsearch-rest</module> <module>google-bigquery</module> + <module>google-pubsub</module> <module>groovy</module> <module>grpc</module> <module>influxdb</module> diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml index 86b4f43..dd42233 100644 --- a/poms/bom-deployment/pom.xml +++ b/poms/bom-deployment/pom.xml @@ -409,6 +409,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-google-pubsub-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-google-sheets-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index 68a49b7..9673068 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -474,6 +474,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-google-pubsub</artifactId> + <version>${camel.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-google-sheets</artifactId> <version>${camel.version}</version> </dependency> @@ -1349,6 +1354,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-google-pubsub</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-google-sheets</artifactId> <version>${camel-quarkus.version}</version> </dependency>