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

Chapter 130. Hazelcast Atomic Number Component


Available as of Camel version 2.7

The Hazelcast atomic number component is one of Camel Hazelcast Components which allows you to access Hazelcast atomic number. An atomic number is an object that simply provides a grid wide number (long).

There is no consumer for this endpoint!

130.1. Options

The Hazelcast Atomic Number component supports 3 options which are listed below.

NameDescriptionDefaultType

hazelcastInstance (advanced)

The hazelcast instance reference which can be used for hazelcast endpoint. If you don’t specify the instance reference, camel use the default hazelcast instance from the camel-hazelcast instance.

 

HazelcastInstance

hazelcastMode (advanced)

The hazelcast mode reference which kind of instance should be used. If you don’t specify the mode, then the node mode will be the default.

node

String

resolveProperty Placeholders (advanced)

Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.

true

boolean

The Hazelcast Atomic Number endpoint is configured using URI syntax:

hazelcast-atomicvalue:cacheName

with the following path and query parameters:

130.1.1. Path Parameters (1 parameters):

NameDescriptionDefaultType

cacheName

Required The name of the cache

 

String

130.1.2. Query Parameters (10 parameters):

NameDescriptionDefaultType

reliable (common)

Define if the endpoint will use a reliable Topic struct or not.

false

boolean

defaultOperation (producer)

To specify a default operation to use, if no operation header has been provided.

 

HazelcastOperation

hazelcastInstance (producer)

The hazelcast instance reference which can be used for hazelcast endpoint.

 

HazelcastInstance

hazelcastInstanceName (producer)

The hazelcast instance reference name which can be used for hazelcast endpoint. If you don’t specify the instance reference, camel use the default hazelcast instance from the camel-hazelcast instance.

 

String

synchronous (advanced)

Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

false

boolean

concurrentConsumers (seda)

To use concurrent consumers polling from the SEDA queue.

1

int

onErrorDelay (seda)

Milliseconds before consumer continues polling after an error has occurred.

1000

int

pollTimeout (seda)

The timeout used when consuming from the SEDA queue. When a timeout occurs, the consumer can check whether it is allowed to continue running. Setting a lower value allows the consumer to react more quickly upon shutdown.

1000

int

transacted (seda)

If set to true then the consumer runs in transaction mode, where the messages in the seda queue will only be removed if the transaction commits, which happens when the processing is complete.

false

boolean

transferExchange (seda)

If set to true the whole Exchange will be transfered. If header or body contains not serializable objects, they will be skipped.

false

boolean

130.2. atomic number producer - to("hazelcast-atomicvalue:foo")

The operations for this producer are: * setvalue (set the number with a given value) * get * increase (+1) * decrease (-1) * destroy

Header Variables for the request message:

NameTypeDescription

CamelHazelcastOperationType

String

valid values are: setvalue, get, increase, decrease, destroy

130.2.1. Sample for set:

Java DSL:

from("direct:set")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastOperation.SET_VALUE))
.toF("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);

Spring DSL:

<route>
    <from uri="direct:set" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
    <setHeader headerName="hazelcast.operation.type">
        <constant>setvalue</constant>
    </setHeader>
    <to uri="hazelcast-atomicvalue:foo" />
</route>

Provide the value to set inside the message body (here the value is 10): template.sendBody("direct:set", 10);

130.2.2. Sample for get:

Java DSL:

from("direct:get")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastOperation.GET))
.toF("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);

Spring DSL:

<route>
    <from uri="direct:get" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
    <setHeader headerName="hazelcast.operation.type">
        <constant>get</constant>
    </setHeader>
    <to uri="hazelcast-atomicvalue:foo" />
</route>

You can get the number with long body = template.requestBody("direct:get", null, Long.class);.

130.2.3. Sample for increment:

Java DSL:

from("direct:increment")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastOperation.INCREMENT))
.toF("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);

Spring DSL:

<route>
    <from uri="direct:increment" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
    <setHeader headerName="hazelcast.operation.type">
        <constant>increment</constant>
    </setHeader>
    <to uri="hazelcast-atomicvalue:foo" />
</route>

The actual value (after increment) will be provided inside the message body.

130.2.4. Sample for decrement:

Java DSL:

from("direct:decrement")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastOperation.DECREMENT))
.toF("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);

Spring DSL:

<route>
    <from uri="direct:decrement" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
    <setHeader headerName="hazelcast.operation.type">
        <constant>decrement</constant>
    </setHeader>
    <to uri="hazelcast-atomicvalue:foo" />
</route>

The actual value (after decrement) will be provided inside the message body.

130.2.5. Sample for destroy

Java DSL:

from("direct:destroy")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastOperation.DESTROY))
.toF("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);

Spring DSL:

<route>
    <from uri="direct:destroy" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
    <setHeader headerName="hazelcast.operation.type">
        <constant>destroy</constant>
    </setHeader>
    <to uri="hazelcast-atomicvalue:foo" />
</route>
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

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

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

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

Red Hat 소개

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

© 2024 Red Hat, Inc.