122.2. hazelcast 参照の使用
122.2.1. その名前別
<bean id="hazelcastLifecycle" class="com.hazelcast.core.LifecycleService"
factory-bean="hazelcastInstance" factory-method="getLifecycleService"
destroy-method="shutdown" />
<bean id="config" class="com.hazelcast.config.Config">
<constructor-arg type="java.lang.String" value="HZ.INSTANCE" />
</bean>
<bean id="hazelcastInstance" class="com.hazelcast.core.Hazelcast" factory-method="newHazelcastInstance">
<constructor-arg type="com.hazelcast.config.Config" ref="config"/>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="testHazelcastInstanceBeanRefPut">
<from uri="direct:testHazelcastInstanceBeanRefPut"/>
<setHeader headerName="CamelHazelcastOperationType">
<constant>put</constant>
</setHeader>
<to uri="hazelcast-map:testmap?hazelcastInstanceName=HZ.INSTANCE"/>
</route>
<route id="testHazelcastInstanceBeanRefGet">
<from uri="direct:testHazelcastInstanceBeanRefGet" />
<setHeader headerName="CamelHazelcastOperationType">
<constant>get</constant>
</setHeader>
<to uri="hazelcast-map:testmap?hazelcastInstanceName=HZ.INSTANCE"/>
<to uri="seda:out" />
</route>
</camelContext>
Copy to clipboardCopied122.2.2. インスタンス別
<bean id="hazelcastInstance" class="com.hazelcast.core.Hazelcast"
factory-method="newHazelcastInstance" />
<bean id="hazelcastLifecycle" class="com.hazelcast.core.LifecycleService"
factory-bean="hazelcastInstance" factory-method="getLifecycleService"
destroy-method="shutdown" />
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="testHazelcastInstanceBeanRefPut">
<from uri="direct:testHazelcastInstanceBeanRefPut"/>
<setHeader headerName="CamelHazelcastOperationType">
<constant>put</constant>
</setHeader>
<to uri="hazelcast-map:testmap?hazelcastInstance=#hazelcastInstance"/>
</route>
<route id="testHazelcastInstanceBeanRefGet">
<from uri="direct:testHazelcastInstanceBeanRefGet" />
<setHeader headerName="CamelHazelcastOperationType">
<constant>get</constant>
</setHeader>
<to uri="hazelcast-map:testmap?hazelcastInstance=#hazelcastInstance"/>
<to uri="seda:out" />
</route>
</camelContext>
Copy to clipboardCopied