= IronMQ Component
:doctitle: IronMQ
:shortname: ironmq
:artifactid: camel-ironmq
:description: Send and receive messages to/from IronMQ an elastic and durable hosted message queue as a service.
:since: 2.17
:supportlevel: Stable
:component-header: Both producer and consumer are supported
//Manually maintained attributes
:camel-spring-boot-name: ironmq

*Since Camel {since}*

*{component-header}*

The IronMQ component provides integration with http://www.iron.io/products/mq[IronMQ] an elastic and durable hosted message queue as a service.

The component uses the
https://github.com/iron-io/iron_mq_java[IronMQ java client]
library.

To run it requires a IronMQ account, and a project id and token.

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-ironmq</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>
------------------------------------------------------------

== URI format

-----------------------------
 ironmq:queueName[?options]
-----------------------------
Where **queueName** identifies the IronMQ queue you want to publish or consume messages from.


// component-configure options: START

// component-configure options: END

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

// endpoint options: START

// endpoint options: END


== Message Body

Should be either a String or a array of Strings. In the latter case the batch of strings will be send to IronMQ as one request, creating one message pr. element in the array.

== Producer message headers

[width="100%",cols="10%,10%,80%",options="header",]
|=======================================================================
|Header |Type | Description
|CamelIronMQOperation |String|If value set to 'CamelIronMQClearQueue' the queue is cleared of unconsumed  messages.
|CamelIronMQMessageId |String or io.iron.ironmq.Ids|The id of the IronMQ message as a String when sending a single message, or a Ids object when sending a array of strings.
|=======================================================================

== Consumer message headers

[width="100%",cols="10%,10%,80%",options="header",]
|=======================================================================
|Header |Type | Description
|CamelIronMQMessageId    |String|The id of the message.
|CamelIronMQReservationId|String|The reservation id of the message.
|CamelIronMQReservedCount|String|The number of times this message has been reserved.
|=======================================================================


== Consumer example

Consume 50 messages pr. poll from the queue 'testqueue' on aws eu, and save the messages to files.

[source,java]
--------------------------------------------------
from("ironmq:testqueue?ironMQCloud=https://mq-aws-eu-west-1-1.iron.io&projectId=myIronMQProjectid&token=myIronMQToken&maxMessagesPerPoll=50")
  .to("file:somefolder");
--------------------------------------------------

== Producer example
Dequeue from activemq jms and enqueue the messages on IronMQ.

[source,java]
--------------------------------------------------
from("activemq:foo")
  .to("ironmq:testqueue?projectId=myIronMQProjectid&token=myIronMQToken");
--------------------------------------------------


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