<commit_before>[[PollingConsumer-PollingConsumer]]
= Polling Consumer

Camel supports implementing the
http://www.enterpriseintegrationpatterns.com/PollingConsumer.html[Polling
Consumer] from the xref:enterprise-integration-patterns.adoc[EIP
patterns] using the
https://github.com/apache/camel/blob/master/core/camel-api/src/main/java/org/apache/camel/PollingConsumer.java[PollingConsumer]
interface which can be created via the
https://github.com/apache/camel/blob/master/core/camel-api/src/main/java/org/apache/camel/Endpoint.java[Endpoint.createPollingConsumer()]
method.

image::eip/PollingConsumerSolution.gif[image]

In Java:

javaEndpoint endpoint = context.getEndpoint("activemq:my.queue");
PollingConsumer consumer = endpoint.createPollingConsumer(); Exchange
exchange = consumer.receive();

The *`ConsumerTemplate`* (discussed below) is also available.
<commit_msg>Fix code block in polling consumer eip adoc<commit_after>[[PollingConsumer-PollingConsumer]]
= Polling Consumer

Camel supports implementing the
http://www.enterpriseintegrationpatterns.com/PollingConsumer.html[Polling
Consumer] from the xref:enterprise-integration-patterns.adoc[EIP
patterns] using the
https://github.com/apache/camel/blob/master/core/camel-api/src/main/java/org/apache/camel/PollingConsumer.java[PollingConsumer]
interface which can be created via the
https://github.com/apache/camel/blob/master/core/camel-api/src/main/java/org/apache/camel/Endpoint.java[Endpoint.createPollingConsumer()]
method.

image::eip/PollingConsumerSolution.gif[image]

In Java:

[source,java]
----
javaEndpoint endpoint = context.getEndpoint("activemq:my.queue");
PollingConsumer consumer = endpoint.createPollingConsumer(); Exchange
exchange = consumer.receive();
----

The *`ConsumerTemplate`* (discussed below) is also available.

{'fraction_non_alphanumeric': 0.12028824833702882, 'fraction_numerical': 0.0, 'mean_word_length': 6.680851063829787, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6274967', 'n_tokens_mistral': 575, 'n_tokens_neox': 539, 'n_words': 96}