이 콘텐츠는 선택한 언어로 제공되지 않습니다.

51.7. gtask


gtask Component

The gtask component contributes to the Camel Components for Google App Engine (GAE). It supports 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

gtask://queue-name
Copy to Clipboard Toggle word wrap

Options

Expand
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 plus the following.
Expand
Name Type Context Description
GTaskBinding.GTASK_QUEUE_NAME String Consumer Name of the task queue.
GTaskBinding.GTASK_TASK_NAME String Consumer Name of the task (generated value).
GTaskBinding.GTASK_RETRY_COUNT int Consumer Number of callback retries.

Message body

On the producer side the in message body is converted to a byte[] and is POSTed to the callback handler as content-type application/octet-stream.

Usage

Setting up tasks queues is an administrative task on Google App Engine. Only one queue is pre-configured and can be referenced by name out-of-the-box: the default queue. This queue will be used in the following examples. Please note that when using task queues on the local development server, tasks must be executed manually from the developer console.

Default queue

...
.to(gtask:default) // add message to default queue

from(gtask:default) // receive message from default queue (via a web hook)
...
Copy to Clipboard Toggle word wrap
This example requires the following servlet mapping.
web.xml
    ...
    <servlet>
        <servlet-name>CamelServlet</servlet-name>
        <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
        ...
    </servlet>
    ...
    <servlet-mapping>
        <servlet-name>CamelServlet</servlet-name>
        <url-pattern>/worker/*</url-pattern>
    </servlet-mapping>
    ...
Copy to Clipboard Toggle word wrap

Dependencies

Maven users will need to add the following dependency to their pom.xml.
pom.xml
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-gae</artifactId>
    <version>${camel-version}</version>
</dependency>
Copy to Clipboard Toggle word wrap
where ${camel-version} must be replaced by the actual version of Apache Camel (2.1.0 or higher).
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat