## Name

GTask — supports asynchronous message processing on GAE by using the task queueing service as message queue

## Overview

GTask endpoints support asynchronous message processing on GAE by using the task queueing service as message queue. For adding messages to a queue it uses the task queue API. For receiving messages from a queue, it installs an HTTP callback handler. The handler is called by an HTTP POST callback (a web hook) initiated by the task queueing service. Whenever a new task is added to a queue a callback will be sent. The GTask component abstracts from these details and supports endpoint URIs that make message queueing on GAE as easy as message queueing with JMS or SEDA.

## URI format

The URI format for a GTask endpoint is:

    gtask://queue-name

## Dependencies

Maven users will need to add a dependency on `camel-gae` to their poms as shown in Example 9, “GTask dependency”.

Example 9. GTask dependency

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-gae</artifactId>
        <version>x.x.x</version>
        <!-- use the same version as your Camel core version -->
    </dependency>

## Options

Table 20, “GTask options” lists the options for a GTask endpoint.

Table 20. GTask options

Name | Default Value | Context | Description
--- | --- | --- | ---
`workerRoot` | `worker` | Producer | The servlet mapping for callback handlers. By default, this component requires a callback servlet mapping of `/worker/*`. If another servlet mapping is used e.g. `/myworker/*` it must be set as option on the producer side: `to("gtask:myqueue?workerRoot=myworker")`.
`inboundBindingRef` | reference to `GTaskBinding` | Consumer | Reference to an `InboundBinding<GTaskEndpoint, HttpServletRequest, HttpServletResponse>` in the registry for customizing the binding of an `Exchange` to the Servlet API. The referenced binding is used as post-processor to `org.apache.camel.component.http.HttpBinding`.
`outboundBindingRef` | reference to `GTaskBinding` | Producer | Reference to an `OutboundBinding<GTaskEndpoint, TaskOptions, void>` in the registry for customizing the binding of an `Exchange` to the task queueing service.

On the consumer-side, all options of the Servlet component are supported.

## Message headers

On the consumer-side all headers of the Servlet component component are supported.

In addition the following `GTaskBinding` headers are used by on the consumer-side.

Name | Type | Description
--- | --- | ---
`GTASK_QUEUE_NAME` | `String` | Name of the task queue.
`GTASK_TASK_NAME` | `String` | Name of the task.
`GTASK_RETRY_COUNT` | `int` | Number of callback retries.

## Related topics

Servlet
task queueing service