This is an automated email from the ASF dual-hosted git repository. ppalaga pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit dcb610a26e22fc9aed199cc264159238d1f6b812 Author: Peter Palaga <ppal...@redhat.com> AuthorDate: Tue Mar 24 12:15:10 2020 +0100 Fix #964 Protobuf dataformat support (JVM only) --- .../pages/list-of-camel-quarkus-extensions.adoc | 5 +- extensions-jvm/pom.xml | 1 + extensions-jvm/protobuf/deployment/pom.xml | 75 ++++++++++++ .../protobuf/deployment/ProtobufProcessor.java | 46 ++++++++ extensions-jvm/protobuf/integration-test/pom.xml | 129 +++++++++++++++++++++ .../component/protobuf/it/ProtobufResource.java | 59 ++++++++++ .../component/protobuf/it/ProtobufRoute.java | 35 ++++++ .../src/main/proto/addressbook.proto | 38 ++++++ .../component/protobuf/it/ProtobufTest.java | 67 +++++++++++ extensions-jvm/protobuf/pom.xml | 40 +++++++ extensions-jvm/protobuf/runtime/pom.xml | 83 +++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 29 +++++ pom.xml | 4 + poms/bom-deployment/pom.xml | 5 + poms/bom/pom.xml | 10 ++ poms/build-parent/pom.xml | 11 +- 16 files changed, 635 insertions(+), 2 deletions(-) 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 1967641..5314620 100644 --- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc +++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc @@ -603,7 +603,7 @@ Level | Since | Description == Camel Data Formats // dataformats: START -Number of Camel data formats: 25 in 20 JAR artifacts (0 deprecated) +Number of Camel data formats: 26 in 21 JAR artifacts (0 deprecated) [width="100%",cols="4,1,1,5",options="header"] |=== @@ -664,6 +664,9 @@ Level | Since | Description | link:https://camel.apache.org/components/latest/mime-multipart-dataformat.html[MIME Multipart] (camel-quarkus-mail) | Native + Stable | 0.2.0 | The MIME Multipart data format is used for marshalling Camel messages with attachments into MIME-Multipart message, and vise-versa. +| link:https://camel.apache.org/components/latest/protobuf-dataformat.html[Protobuf] (camel-quarkus-protobuf) | JVM + + Preview | 1.0.0-M6 | The Protobuf data format is used for serializing between Java objects and the Google Protobuf protocol. + | link:https://camel.apache.org/components/latest/soapjaxb-dataformat.html[SOAP] (camel-quarkus-soap) | Native + Stable | 1.0.0-M5 | SOAP is a data format which uses JAXB2 and JAX-WS annotations to marshal and unmarshal SOAP payloads. diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml index ded5ca0..212a060 100644 --- a/extensions-jvm/pom.xml +++ b/extensions-jvm/pom.xml @@ -67,6 +67,7 @@ <module>nitrite</module> <module>ognl</module> <module>openstack</module> + <module>protobuf</module> <module>pubnub</module> <module>rabbitmq</module> <module>sap-netweaver</module> diff --git a/extensions-jvm/protobuf/deployment/pom.xml b/extensions-jvm/protobuf/deployment/pom.xml new file mode 100644 index 0000000..d4b0a6a --- /dev/null +++ b/extensions-jvm/protobuf/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-protobuf-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-protobuf-deployment</artifactId> + <name>Camel Quarkus :: Protobuf :: 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-protobuf</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/protobuf/deployment/src/main/java/org/apache/camel/quarkus/component/protobuf/deployment/ProtobufProcessor.java b/extensions-jvm/protobuf/deployment/src/main/java/org/apache/camel/quarkus/component/protobuf/deployment/ProtobufProcessor.java new file mode 100644 index 0000000..0d0e1ae --- /dev/null +++ b/extensions-jvm/protobuf/deployment/src/main/java/org/apache/camel/quarkus/component/protobuf/deployment/ProtobufProcessor.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.protobuf.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 ProtobufProcessor { + + private static final Logger LOG = Logger.getLogger(ProtobufProcessor.class); + private static final String FEATURE = "camel-protobuf"; + + @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/protobuf/integration-test/pom.xml b/extensions-jvm/protobuf/integration-test/pom.xml new file mode 100644 index 0000000..eb303bd --- /dev/null +++ b/extensions-jvm/protobuf/integration-test/pom.xml @@ -0,0 +1,129 @@ +<?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-protobuf-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-quarkus-protobuf-integration-test</artifactId> + <name>Camel Quarkus :: Protobuf :: Integration Test</name> + <description>Integration tests for Camel Quarkus Protobuf 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-protobuf-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-protobuf</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct</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>kr.motd.maven</groupId> + <artifactId>os-maven-plugin</artifactId> + <executions> + <execution> + <phase>initialize</phase> + <goals> + <goal>detect</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.xolstice.maven.plugins</groupId> + <artifactId>protobuf-maven-plugin</artifactId> + <extensions>true</extensions> + <executions> + <execution> + <goals> + <goal>compile</goal> + </goals> + <phase>generate-sources</phase> + <configuration> + <protocArtifact> + com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} + </protocArtifact> + <checkStaleness>true</checkStaleness> + </configuration> + </execution> + </executions> + </plugin> + <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/protobuf/integration-test/src/main/java/org/apache/camel/quarkus/component/protobuf/it/ProtobufResource.java b/extensions-jvm/protobuf/integration-test/src/main/java/org/apache/camel/quarkus/component/protobuf/it/ProtobufResource.java new file mode 100644 index 0000000..3cc02a5 --- /dev/null +++ b/extensions-jvm/protobuf/integration-test/src/main/java/org/apache/camel/quarkus/component/protobuf/it/ProtobufResource.java @@ -0,0 +1,59 @@ +/* + * 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.protobuf.it; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.apache.camel.ProducerTemplate; +import org.apache.camel.quarkus.component.protobuf.it.model.AddressBookProtos.Person; + +@Path("/protobuf") +@ApplicationScoped +public class ProtobufResource { + + @Inject + ProducerTemplate producerTemplate; + + @Path("/marshal") + @GET + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public byte[] xstreamXmlMarshal(@QueryParam("id") int id, @QueryParam("name") String name) { + final Person person = Person.newBuilder() + .setId(id) + .setName(name) + .build(); + return producerTemplate.requestBody("direct:protobuf-marshal", person, byte[].class); + } + + @Path("/unmarshal") + @POST + @Consumes(MediaType.APPLICATION_OCTET_STREAM) + @Produces(MediaType.APPLICATION_JSON) + public String unmarshal(byte[] body) { + final Person person = producerTemplate.requestBody("direct:protobuf-unmarshal", body, Person.class); + return "{\"name\": \"" + person.getName() + "\",\"id\": " + person.getId() + "}"; + } + +} diff --git a/extensions-jvm/protobuf/integration-test/src/main/java/org/apache/camel/quarkus/component/protobuf/it/ProtobufRoute.java b/extensions-jvm/protobuf/integration-test/src/main/java/org/apache/camel/quarkus/component/protobuf/it/ProtobufRoute.java new file mode 100644 index 0000000..f74d60e --- /dev/null +++ b/extensions-jvm/protobuf/integration-test/src/main/java/org/apache/camel/quarkus/component/protobuf/it/ProtobufRoute.java @@ -0,0 +1,35 @@ +/* + * 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.protobuf.it; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.quarkus.component.protobuf.it.model.AddressBookProtos.Person; + +public class ProtobufRoute extends RouteBuilder { + + @Override + public void configure() throws Exception { + from("direct:protobuf-marshal") + .marshal() + .protobuf(Person.class.getName()); + + from("direct:protobuf-unmarshal") + .unmarshal() + .protobuf(Person.class.getName()); + + } +} diff --git a/extensions-jvm/protobuf/integration-test/src/main/proto/addressbook.proto b/extensions-jvm/protobuf/integration-test/src/main/proto/addressbook.proto new file mode 100644 index 0000000..b753665 --- /dev/null +++ b/extensions-jvm/protobuf/integration-test/src/main/proto/addressbook.proto @@ -0,0 +1,38 @@ +syntax = "proto2"; + +package org.apache.camel.quarkus.component.protobuf.it.model; + +option java_package = "org.apache.camel.quarkus.component.protobuf.it.model"; +option java_outer_classname = "AddressBookProtos"; + +message Person { + required string name = 1; + required int32 id = 2; + optional string email = 3; + + enum PhoneType { + MOBILE = 0; + HOME = 1; + WORK = 2; + } + + message PhoneNumber { + required string number = 1; + required PhoneType type = 2 [default = HOME]; + } + + repeated PhoneNumber phone = 4; + repeated string nicknames = 5; + + message Address { + optional string street = 1; + optional int32 street_number = 2; + optional bool is_valid = 3; + } + + optional Address address = 6; +} + +message AddressBook { + repeated Person person = 1; +} \ No newline at end of file diff --git a/extensions-jvm/protobuf/integration-test/src/test/java/org/apache/camel/quarkus/component/protobuf/it/ProtobufTest.java b/extensions-jvm/protobuf/integration-test/src/test/java/org/apache/camel/quarkus/component/protobuf/it/ProtobufTest.java new file mode 100644 index 0000000..8a019b6 --- /dev/null +++ b/extensions-jvm/protobuf/integration-test/src/test/java/org/apache/camel/quarkus/component/protobuf/it/ProtobufTest.java @@ -0,0 +1,67 @@ +/* + * 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.protobuf.it; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import org.apache.camel.quarkus.component.protobuf.it.model.AddressBookProtos.Person; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.Matchers.equalTo; + +@QuarkusTest +class ProtobufTest { + final static int id = 2345; + final static String name = "Joe"; + final static String json = "{\"name\": \"" + name + "\",\"id\": " + id + "}"; + final static Person person = Person.newBuilder() + .setId(id) + .setName(name) + .build(); + final static byte[] protobuf = person.toByteArray(); + + @Test + void marshal() { + + final byte[] actual = RestAssured.given() + .contentType("application/json") + .queryParam("name", name) + .queryParam("id", id) + .get("/protobuf/marshal") + .then() + .statusCode(200) + .extract() + .body() + .asByteArray(); + + Assertions.assertArrayEquals(protobuf, actual); + } + + @Test + void unmarshal() { + + RestAssured.given() + .contentType("application/octet-stream") + .body(protobuf) + .post("/protobuf/unmarshal") + .then() + .statusCode(200) + .body(equalTo(json)); + + } +} diff --git a/extensions-jvm/protobuf/pom.xml b/extensions-jvm/protobuf/pom.xml new file mode 100644 index 0000000..75df618 --- /dev/null +++ b/extensions-jvm/protobuf/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-protobuf-parent</artifactId> + <name>Camel Quarkus :: Protobuf</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + <module>integration-test</module> + </modules> +</project> diff --git a/extensions-jvm/protobuf/runtime/pom.xml b/extensions-jvm/protobuf/runtime/pom.xml new file mode 100644 index 0000000..566790a --- /dev/null +++ b/extensions-jvm/protobuf/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-protobuf-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-protobuf</artifactId> + <name>Camel Quarkus :: Protobuf :: Runtime</name> + <description>The Protobuf data format is used for serializing between Java objects and the Google Protobuf protocol.</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-protobuf</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/protobuf/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-jvm/protobuf/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..d50e035 --- /dev/null +++ b/extensions-jvm/protobuf/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,29 @@ +# +# 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: "Protobuf" +description: "The Protobuf data format is used for serializing between Java objects and the Google Protobuf protocol." +metadata: + unlisted: true + keywords: + - "dataformat" + - "transformation" + guide: "https://camel.apache.org/components/latest/protobuf-dataformat.html" + categories: + - "integration" + status: "preview" diff --git a/pom.xml b/pom.xml index 2ecbf3d..86dd028 100644 --- a/pom.xml +++ b/pom.xml @@ -60,6 +60,7 @@ <kotlin.version>1.3.61</kotlin.version> <quarkus.version>1.3.0.Final</quarkus.version> <quarkus-qpid-jms.version>0.11.3</quarkus-qpid-jms.version> + <protobuf.version>3.11.1</protobuf.version> <retrofit.version>2.5.0</retrofit.version> <!-- Keep spring.version aligned with the version used by Camel --> <spring.version>5.2.3.RELEASE</spring.version> @@ -92,7 +93,9 @@ <groovy-maven-plugin.version>2.1.1</groovy-maven-plugin.version> <groovy.version>2.5.8</groovy.version> <jandex-maven-plugin.version>1.0.7</jandex-maven-plugin.version> + <os-maven-plugin.version>1.6.2</os-maven-plugin.version> <properties-maven-plugin.version>1.0.0</properties-maven-plugin.version> + <protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version> <mycila-license.version>3.0</mycila-license.version> <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version> <maven-deploy-plugin.version>3.0.0-M1</maven-deploy-plugin.version> @@ -288,6 +291,7 @@ <exclude>**/*.mvel</exclude> <exclude>**/*.p12</exclude> <exclude>**/*.pem</exclude> + <exclude>**/*.proto</exclude> <exclude>**/*.txt</exclude> <exclude>**/.factorypath</exclude> <exclude>**/LICENSE.txt</exclude> diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml index a678b4c..a716239 100644 --- a/poms/bom-deployment/pom.xml +++ b/poms/bom-deployment/pom.xml @@ -604,6 +604,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-protobuf-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-pubnub-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index 41c2016..a3dfaf5 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -776,6 +776,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-protobuf</artifactId> + <version>${camel.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-pubnub</artifactId> <version>${camel.version}</version> </dependency> @@ -1539,6 +1544,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-protobuf</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-pubnub</artifactId> <version>${camel-quarkus.version}</version> </dependency> diff --git a/poms/build-parent/pom.xml b/poms/build-parent/pom.xml index d2d0314..547dec7 100644 --- a/poms/build-parent/pom.xml +++ b/poms/build-parent/pom.xml @@ -76,7 +76,11 @@ </execution> </executions> </plugin> - + <plugin> + <groupId>kr.motd.maven</groupId> + <artifactId>os-maven-plugin</artifactId> + <version>${os-maven-plugin.version}</version> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> @@ -105,6 +109,11 @@ <version>${jandex-maven-plugin.version}</version> </plugin> <plugin> + <groupId>org.xolstice.maven.plugins</groupId> + <artifactId>protobuf-maven-plugin</artifactId> + <version>${protobuf-maven-plugin.version}</version> + </plugin> + <plugin> <groupId>net.revelc.code.formatter</groupId> <artifactId>formatter-maven-plugin</artifactId> <version>${formatter-maven-plugin.version}</version>