This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit dcae4ed0a61e8f23e9ba3db9d1feff18754e2482 Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Wed Feb 21 15:59:14 2024 +0100 CAMEL-20410: documentation fixes for camel-protobuf - Fixed samples - Fixed grammar and typos - Fixed punctuation - Added and/or fixed links - Converted to use tabs --- .../src/main/docs/protobuf-dataformat.adoc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc b/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc index dbe1848cad7..863da26be3f 100644 --- a/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc +++ b/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc @@ -40,7 +40,7 @@ include::partial$dataformat-options.adoc[] It's possible to parse JSON message to convert it to the protobuf format and unparse it back using native util converter. To use this option, set contentTypeFormat value to 'json' or call protobuf with second parameter. -If default instance is not specified, always use native protobuf format. +If the default instance is not specified, always use the native protobuf format. The sample code shows below: [source,java] @@ -52,16 +52,18 @@ from("direct:marshal") -------------------------------------------------------------------------------------------------- == Input data type -This dataformat supports marshaling input data either as protobuf `Message` type or `Map` data type. In case of input data as `Map` type, first it will try to retrieve the data as `Map` using built-in type converters, if it fails to +This dataformat supports marshaling input data either as protobuf `Message` type or `Map` data type. +In case of input data as `Map` type, first it will try to retrieve the data as `Map` using built-in type converters, if it fails to do so, it will fall back to retrieve it as proto `Message`. == Output data type -As mentioned above, you can define the content type format to choose from JSON or native to serialize/deserialize data from/to. In addition, you can also obtain the data as `Map` and let this component to do the heavy lifting to parse the -data from proto `Message` to `Map`, you will just need to set the `contentTypeFormat` to *native* and explicitly define the data type `Map` when you obtain body of the exchange, e.g: `exchange.getMessage().getBody(Map.class)`. +As mentioned above, you can define the content type format to choose from JSON or native to serialize/deserialize data from/to. +In addition, you can also obtain the data as `Map` and let this component do the heavy lifting to parse the +data from proto `Message` to `Map`, you will need to set the `contentTypeFormat` to *native* and explicitly define the data type `Map` when you obtain body of the exchange, e.g.: `exchange.getMessage().getBody(Map.class)`. == Protobuf overview -This quick overview of how to use Protobuf. For more detail see the +This quick overview of how to use Protobuf. For more detail, see the https://developers.google.com/protocol-buffers/docs/javatutorial[complete tutorial] == Defining the proto format @@ -108,8 +110,8 @@ message AddressBook { The Protobuf SDK provides a compiler which will generate the Java classes for the format we defined in our .proto file. -If your operating system is supporting by https://www.xolstice.org/protobuf-maven-plugin[Protobuf Java code generator maven plugin], -you can automate protobuf Java code generating by adding following configurations to your pom.xml: +If your operating system is supported by https://www.xolstice.org/protobuf-maven-plugin[Protobuf Java code generator maven plugin], +you can automate protobuf Java code generating by adding the following configurations to your `pom.xml`: Insert operating system and CPU architecture detection extension inside **<build>** tag of the project pom.xml or set ${os.detected.classifier} parameter manually [source,xml] @@ -152,7 +154,7 @@ This will generate a single Java class named AddressBookProtos which contains inner classes for Person and AddressBook. Builders are also implemented for you. The generated classes implement com.google.protobuf.Message which is required by the serialization -mechanism. For this reason it important that only these classes are used +mechanism. For this reason it is important that only these classes are used in the body of your exchanges. Camel will throw an exception on route creation if you attempt to tell the Data Format to use a class that does not implement com.google.protobuf.Message. Use @@ -206,8 +208,8 @@ configuring the protobuf data type == Dependencies -To use Protobuf in your camel routes you need to add the a dependency on -*camel-protobuf* which implements this data format. +To use Protobuf in your Camel routes you need to add the dependency on +*camel-protobuf*, which implements this data format. [source,xml] -----------------------------------------
