[[lzf-dataformat]]
= LZF Deflate Compression DataFormat
:docTitle: LZF Deflate Compression
:shortname: lzf
:artifactId: camel-lzf
:description: Compress and decompress streams using LZF deflate algorithm.
:since: 2.17
:supportLevel: Stable
//Manually maintained attributes
:camel-spring-boot-name: lzf

*Since Camel {since}*

The
LZF xref:manual::data-format.adoc[Data Format] is a message compression
and de-compression format. It uses the
LZF deflate algorithm. Messages marshalled using LZF compression can be
unmarshalled using LZF 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 or when you read messages previously
comressed using LZF algotithm.

== Options

// dataformat options: START
The LZF Deflate Compression dataformat supports 1 options, which are listed below.



[width="100%",cols="2s,1m,1m,6",options="header"]
|===
| Name | Default | Java Type | Description
| usingParallelCompression | false | Boolean | Enable encoding (compress) using multiple processing cores.
|===
// dataformat options: END

== Marshal

In this example we marshal a regular text/XML payload to a compressed
payload employing LZF compression format and send it an ActiveMQ queue
called MY_QUEUE.

[source,java]
-------------------------------------------------------------------
from("direct:start").marshal().lzf().to("activemq:queue:MY_QUEUE");
-------------------------------------------------------------------

== Unmarshal

In this example we unmarshal a LZF payload from an ActiveMQ queue called
MY_QUEUE to its original format, and forward it for processing to
the `UnGZippedMessageProcessor`.

[source,java]
----------------------------------------------------------------------------------------------
from("activemq:queue:MY_QUEUE").unmarshal().lzf().process(new UnCompressedMessageProcessor());
----------------------------------------------------------------------------------------------

== Dependencies

To useLZF compression in your camel routes you need to add a dependency
on *camel-lzf* which implements this data format.

If you use Maven you can just add the following to your `pom.xml`,
substituting the version number for the latest & greatest release.

[source,xml]
----------------------------------------------------------
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-lzf</artifactId>
  <version>x.x.x</version>
  <!-- use the same version as your Camel core version -->
</dependency>
----------------------------------------------------------


include::spring-boot:partial$starter.adoc[]
