[
https://issues.apache.org/jira/browse/CAMEL-11497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386140#comment-16386140
]
ASF GitHub Bot commented on CAMEL-11497:
----------------------------------------
davsclaus closed pull request #2245: CAMEL-11497 - add marshal and unmarshal
eip docs
URL: https://github.com/apache/camel/pull/2245
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/camel-core/src/main/docs/eips/marshal-eip.adoc
b/camel-core/src/main/docs/eips/marshal-eip.adoc
new file mode 100644
index 00000000000..1db58236b25
--- /dev/null
+++ b/camel-core/src/main/docs/eips/marshal-eip.adoc
@@ -0,0 +1,38 @@
+[[marshal-eip]]
+== Marshal EIP
+
+Marshalling is the opposite of unmarshalling, where a bean is marshalled into
some binary or textual format for transmission over some transport via a Camel
link:https://github.com/apache/camel/tree/master/components[Components].
Marshalling is used in the same way as unmarshalling above; in the
link:https://github.com/apache/camel/blob/master/docs/user-manual/en/dsl.adoc[DSL]
you can use a DataFormat instance, you can configure the DataFormat
dynamically using the DSL or you can refer to a named instance of the format in
the
link:https://github.com/apache/camel/blob/master/docs/user-manual/en/registry.adoc[Registry].
+
+== Options
+
+// eip options: START
+The Marshal EIP supports 0 options which are listed below:
+// eip options: END
+
+=== Samples
+
+The following example unmarshals via serialization then marshals using a named
JAXB data format to perform a kind of
link:https://github.com/apache/camel/blob/master/camel-core/src/main/docs/eips/message-translator.adoc[Message
Translator]
+
+[source,java]
+----
+from("file://foo/bar").
+ unmarshal().serialization().
+ marshal("jaxb").
+ to("activemq:Some.Queue");
+----
+
+[[DataFormat-UsingSpringXML]]
+==== Using Spring XML
+
+This example shows how to configure the data type just once and reuse it
+on multiple routes
+
+You can also define reusable data formats as Spring beans
+
+[source,xml]
+--------------------------------------------------------
+<bean id="myJaxb" class="org.apache.camel.model.dataformat.JaxbDataFormat">
+ <property name="prettyPrint" value="true"/>
+ <property name="contextPath" value="org.apache.camel.example"/>
+</bean>
+--------------------------------------------------------
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/unmarshal-eip.adoc
b/camel-core/src/main/docs/eips/unmarshal-eip.adoc
new file mode 100644
index 00000000000..3797245838b
--- /dev/null
+++ b/camel-core/src/main/docs/eips/unmarshal-eip.adoc
@@ -0,0 +1,37 @@
+[[unmarshal-eip]]
+== Unmarshal EIP
+
+If you receive a message from one of the Camel
link:https://github.com/apache/camel/tree/master/components[Components] such as
link:https://github.com/apache/camel/blob/master/camel-core/src/main/docs/file-component.adoc[File],
link:https://github.com/apache/camel/blob/master/components/camel-http/src/main/docs/http-component.adoc[HTTP]
or
link:https://github.com/apache/camel/blob/master/components/camel-jms/src/main/docs/jms-component.adoc[JMS]
you often want to unmarshal the payload into some bean so that you can process
it using some
link:https://github.com/apache/camel/blob/master/docs/user-manual/en/bean-integration.adoc[Bean
Integration] or perform
link:https://github.com/apache/camel/blob/master/docs/user-manual/en/expression.adoc#predicate[Predicate]
evaluation and so forth. To do this use the *unmarshal* word in the
link:https://github.com/apache/camel/blob/master/docs/user-manual/en/dsl.adoc[DSL]
in Java or the
link:https://github.com/apache/camel/blob/master/docs/user-manual/en/camel-configuration-utilities.adoc#xml-configuration[Xml
Configuration].
+
+== Options
+
+// eip options: START
+The Unmarshal EIP supports 0 options which are listed below:
+// eip options: END
+
+=== Samples
+
+For example
+
+[source,java]
+----
+DataFormat jaxb = new JaxbDataFormat("com.acme.model");
+
+from("activemq:My.Queue").
+ unmarshal(jaxb).
+ to("mqseries:Another.Queue");
+----
+
+The above uses a named DataFormat of _jaxb_ which is configured with a number
of Java package names. You can if you prefer use a named reference to a data
format which can then be defined in your
link:https://github.com/apache/camel/blob/master/docs/user-manual/en/registry.adoc[Registry]
such as via your link:spring.html[Spring] XML file.
+
+You can also use the DSL itself to define the data format as you use it.
+For example the following uses Java serialization to unmarshal a binary
+file then send it as an ObjectMessage to
link:https://github.com/apache/camel/tree/master/docs/user-manual/en/activemq.adoc[ActiveMQ]
+
+[source,java]
+----
+from("file://foo/bar").
+ unmarshal().serialization().
+ to("activemq:Some.Queue");
+----
+
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Migrate the rest of the Confluence content
> ------------------------------------------
>
> Key: CAMEL-11497
> URL: https://issues.apache.org/jira/browse/CAMEL-11497
> Project: Camel
> Issue Type: Sub-task
> Components: website
> Reporter: Zoran Regvart
> Assignee: Önder Sezgin
> Priority: Major
> Fix For: Future
>
>
> There are still pages in the Confluence that are not migrated to Asciidoctor
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)