You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/08/31 08:21:39 UTC

[3/8] camel git commit: Added Zip dataformat docs to Gitbook

Added Zip dataformat docs to Gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a674c59b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a674c59b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a674c59b

Branch: refs/heads/master
Commit: a674c59b638cfcfe6814ff5b4e71c8a99da3152f
Parents: 329a8db
Author: Andrea Cosentino <an...@gmail.com>
Authored: Wed Aug 31 09:50:49 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Wed Aug 31 09:50:49 2016 +0200

----------------------------------------------------------------------
 camel-core/src/main/docs/zip-dataformat.adoc | 78 +++++++++++++++++++++++
 1 file changed, 78 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a674c59b/camel-core/src/main/docs/zip-dataformat.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/zip-dataformat.adoc b/camel-core/src/main/docs/zip-dataformat.adoc
new file mode 100644
index 0000000..f63bb2e
--- /dev/null
+++ b/camel-core/src/main/docs/zip-dataformat.adoc
@@ -0,0 +1,78 @@
+[[Zip-Dataformat]]
+Zip Dataformat
+~~~~~~~~~~~~~~
+
+The Zip link:data-format.html[Data Format] is a message compression and
+de-compression format. Messages marshalled using Zip compression can be
+unmarshalled using Zip decompression just prior to being consumed at the
+endpoint. The compression capability is quite useful when you deal with
+large XML and Text based payloads. It facilitates more optimal use of
+network bandwidth while incurring a small cost in order to compress and
+decompress payloads at the endpoint.
+
+INFO:*About using with Files*
+The Zip data format, does not (yet) have special support for files.
+Which means that when using big files, the entire file content is loaded
+into memory. This is subject to change in the future, to allow a streaming based
+solution to have a low memory footprint.
+
+[[ZipDataFormat-Options]]
+Options
+^^^^^^^
+
+// dataformat options: START
+The Zip Deflate Compression dataformat supports 1 options which are listed below.
+
+
+
+{% raw %}
+[width="100%",cols="2s,1m,1m,6",options="header"]
+|=======================================================================
+| Name | Default | Java Type | Description
+| compressionLevel | -1 | Integer | To specify a specific compression between 0-9. -1 is default compression 0 is no compression and 9 is best compression.
+|=======================================================================
+{% endraw %}
+// dataformat options: END
+
+[[ZipDataFormat-Marshal]]
+Marshal
+^^^^^^^
+
+In this example we marshal a regular text/XML payload to a compressed
+payload employing zip compression `Deflater.BEST_COMPRESSION` and send
+it an ActiveMQ queue called MY_QUEUE.
+
+[source,java]
+--------------------------------------------------------------------------------------------
+from("direct:start").marshal().zip(Deflater.BEST_COMPRESSION).to("activemq:queue:MY_QUEUE");
+--------------------------------------------------------------------------------------------
+
+Alternatively if you would like to use the default setting you could
+send it as
+
+[source,java]
+-------------------------------------------------------------------
+from("direct:start").marshal().zip().to("activemq:queue:MY_QUEUE");
+-------------------------------------------------------------------
+
+[[ZipDataFormat-Unmarshal]]
+Unmarshal
+^^^^^^^^^
+
+In this example we unmarshal�a zipped�payload from an ActiveMQ queue
+called MY_QUEUE�to its original format,�and forward it for�processing�to
+the UnZippedMessageProcessor. Note that the compression Level employed
+during the marshalling should be identical to the one employed during
+unmarshalling to avoid errors.
+
+[source,java]
+-------------------------------------------------------------------------------------------
+from("activemq:queue:MY_QUEUE").unmarshal().zip().process(new UnZippedMessageProcessor());�
+-------------------------------------------------------------------------------------------
+
+[[ZipDataFormat-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+This data format is provided in *camel-core* so no additional
+dependencies are needed.