= Atom Component
:doctitle: Atom
:shortname: atom
:artifactid: camel-atom
:description: Poll Atom RSS feeds.
:since: 1.2
:supportlevel: Stable
:tabs-sync-option:
:component-header: Only consumer is supported
//Manually maintained attributes
:camel-spring-boot-name: atom

*Since Camel {since}*

*{component-header}*

The Atom component is used for polling Atom feeds.

Camel will poll the feed every 60 seconds by default. +
 *Note:* The component currently only supports polling (consuming)
feeds.

Maven users will need to add the following dependency to their `pom.xml`
for this component:

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

== URI format

[source,java]
------------------------
atom://atomUri[?options]
------------------------

Where *atomUri* is the URI to the Atom feed to poll.


// component options: START
include::partial$component-configure-options.adoc[]
include::partial$component-endpoint-options.adoc[]
include::partial$component-endpoint-headers.adoc[]
// component options: END


== Exchange data format

Camel will set the In body on the returned `Exchange` with the entries.
Depending on the `splitEntries` flag Camel will either return one
`Entry` or a `List<Entry>`.

[width="100%",cols="10%,10%,80%",options="header",]
|=======================================================================
|Option |Value |Behavior
|`splitEntries` |`true` |Only a single entry from the currently being processed feed is set:
`exchange.in.body(Entry)`

|`splitEntries` |`false` |The entire list of entries from the feed is set:
`exchange.in.body(List<Entry>)`
|=======================================================================

Camel can set the `Feed` object on the In header (see `feedHeader`
option to disable this):

== Usage

=== Avoid reading the same entry more than once (idempotent consumer)

Camel supports Idempotent Consumer
directly within the component, so it will skip already processed entries.
This feature is enabled by default, but can be disabled by setting the `idempotent=false` option.

[source,java]
----
from("file://inbox?idempotent=false").to("...");
----

The default Idempotency strategy uses Atom published and updated timestamps to identify already
read entries, by filtering all entries older that the _last read_ entry.

The idempotency strategy can be changed by setting the `idempotentStrategy` option. The components support two
strategies _out-of-the-box_, but custom strategies can be used, by referencing a subclass 
of `org.apache.camel.component.atom.AtomIdempotentStrategy`, with Apache Camel's # notation.

[source,java]
----
from("file://inbox?idempotentStrategy=#myIdempotentStrategy").to("...");
----

==== Repository idempotent strategy
As an alternative to the default idempotent strategy, a repository based strategy can be use:

[source,java]
----
from("file://inbox?idempotentStrategy=repository").to("...");
----

This strategy checks for idempotency by storing the Atom Entry GUID in an `IdempotentRepository`. The strategy defaults
a MemoryIdempotentRepository, but the repository can be changes to any subclass of `IdempotentRepository`, using the
`idempotentRepository` option.


== Examples

=== Consumer Example

In this sample, we poll James Strachan's blog.

[source,java]
---------------------------------------------------------------------------------
from("atom://http://macstrac.blogspot.com/feeds/posts/default").to("seda:feeds");
---------------------------------------------------------------------------------

In this sample, we want to filter only good blogs we like to a SEDA
queue.
The sample also shows how to set up Camel standalone, not running
in any Container or using Spring.


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