You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Volodymyr Buell (JIRA)" <ji...@apache.org> on 2010/05/12 11:25:49 UTC
[jira] Commented: (CAMEL-2603) support get operation for cache
[ https://issues.apache.org/activemq/browse/CAMEL-2603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59303#action_59303 ]
Volodymyr Buell commented on CAMEL-2603:
----------------------------------------
Example of GET command usage:
from("direct:start")
// Prepare headers
.setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_GET))
.setHeader(CacheConstants.CACHE_KEY, constant("Ralph_Waldo_Emerson")).
.to("cache://TestCache1").
// Check if entry was not found
.choice().when(header(CacheConstants.CACHE_ELEMENT_WAS_FOUND).isNull()).
// If not found, get the payload and put it to cache
.to("cxf:bean:someHeavyweightOperation").
.setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_ADD))
.setHeader(CacheConstants.CACHE_KEY, constant("Ralph_Waldo_Emerson"))
.to("cache://TestCache1")
.end()
.to("direct:nextPhase");
Example of CHECK command usage:
from("direct:start")
// Prepare headers
.setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_CHECK))
.setHeader(CacheConstants.CACHE_KEY, constant("Ralph_Waldo_Emerson")).
.to("cache://TestCache1").
// Check if entry was not found
.choice().when(header(CacheConstants.CACHE_ELEMENT_WAS_FOUND).isNull()).
// If not found, get the payload and put it to cache
.to("cxf:bean:someHeavyweightOperation").
.setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_ADD))
.setHeader(CacheConstants.CACHE_KEY, constant("Ralph_Waldo_Emerson"))
.to("cache://TestCache1")
.end();
Note: CHECK command tests existence of the entry in the cache but doesn't place message to the body.
> support get operation for cache
> -------------------------------
>
> Key: CAMEL-2603
> URL: https://issues.apache.org/activemq/browse/CAMEL-2603
> Project: Apache Camel
> Issue Type: Improvement
> Affects Versions: 2.2.0
> Reporter: Anand
> Assignee: Claus Ibsen
> Fix For: 2.3.0
>
> Attachments: camel-cache_get_refactoring-vb.patch
>
>
> Please support get operation on cache component.
> here is the discussion.
> http://old.nabble.com/read-from-cache-component-ts28071593.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.