138.3. replicatedmap 캐시 생산자
replicatedmap 생산자는 4개의 작업을 제공합니다. * put * get * delete * clear
요청 메시지의 헤더 변수:
이름 | 유형 | 설명 |
---|---|---|
|
| 유효한 값은 put, get, removevalue, delete 입니다. |
|
| 저장할 오브젝트 ID / 캐시 내에서 오브젝트를 찾습니다. |
138.3.1. 페일링을 위한 샘플:
Java DSL:
from("direct:put") .setHeader(HazelcastConstants.OPERATION, constant(HazelcastOperation.PUT)) .to(String.format("hazelcast-%sbar", HazelcastConstants.REPLICATEDMAP_PREFIX));
Spring DSL:
<route> <from uri="direct:put" /> <log message="put.."/> <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" --> <setHeader headerName="hazelcast.operation.type"> <constant>put</constant> </setHeader> <to uri="hazelcast-replicatedmap:foo" /> </route>
138.3.2. 제품 상세 정보:
Java DSL:
from("direct:get") .setHeader(HazelcastConstants.OPERATION, constant(HazelcastOperation.GET)) .toF("hazelcast-%sbar", HazelcastConstants.REPLICATEDMAP_PREFIX) .to("seda:out");
Spring DSL:
<route> <from uri="direct:get" /> <log message="get.."/> <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" --> <setHeader headerName="hazelcast.operation.type"> <constant>get</constant> </setHeader> <to uri="hazelcast-replicatedmap:foo" /> <to uri="seda:out" /> </route>
138.3.3. 삭제 샘플:
Java DSL:
from("direct:delete") .setHeader(HazelcastConstants.OPERATION, constant(HazelcastOperation.DELETE)) .toF("hazelcast-%sbar", HazelcastConstants.REPLICATEDMAP_PREFIX);
Spring DSL:
<route> <from uri="direct:delete" /> <log message="delete.."/> <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" --> <setHeader headerName="hazelcast.operation.type"> <constant>delete</constant> </setHeader> <to uri="hazelcast-replicatedmap:foo" /> </route>
다음과 같이 테스트 클래스에서 호출할 수 있습니다.
template.sendBodyAndHeader("direct:[put|get|delete|clear]", "my-foo", HazelcastConstants.OBJECT_ID, "4711");