use of com.hazelcast.core.HazelcastInstance in project spring-boot by spring-projects.
the class HazelcastAutoConfigurationTests method explicitConfigFile.
@Test
public void explicitConfigFile() throws IOException {
load("spring.hazelcast.config=org/springframework/boot/autoconfigure/hazelcast/" + "hazelcast-specific.xml");
HazelcastInstance hazelcastInstance = this.context.getBean(HazelcastInstance.class);
assertThat(hazelcastInstance.getConfig().getConfigurationFile()).isEqualTo(new ClassPathResource("org/springframework/boot/autoconfigure/hazelcast" + "/hazelcast-specific.xml").getFile());
}
use of com.hazelcast.core.HazelcastInstance in project spring-boot by spring-projects.
the class HazelcastAutoConfigurationTests method configInstanceWithoutName.
@Test
public void configInstanceWithoutName() {
load(HazelcastConfigNoName.class, "spring.hazelcast.config=this-is-ignored.xml");
HazelcastInstance hazelcastInstance = this.context.getBean(HazelcastInstance.class);
Map<String, QueueConfig> queueConfigs = hazelcastInstance.getConfig().getQueueConfigs();
assertThat(queueConfigs).hasSize(1).containsKey("another-queue");
}
use of com.hazelcast.core.HazelcastInstance in project spring-boot by spring-projects.
the class SessionAutoConfigurationHazelcastTests method customMapName.
@Test
public void customMapName() {
load(Collections.<Class<?>>singletonList(HazelcastConfiguration.class), "spring.session.store-type=hazelcast", "spring.session.hazelcast.map-name=foo:bar:biz");
validateSessionRepository(HazelcastSessionRepository.class);
HazelcastInstance hazelcastInstance = this.context.getBean(HazelcastInstance.class);
verify(hazelcastInstance, times(1)).getMap("foo:bar:biz");
}
use of com.hazelcast.core.HazelcastInstance in project camel by apache.
the class HazelcastRoute method configure.
@Override
public void configure() throws Exception {
HazelcastComponent component = new HazelcastComponent();
ClientConfig config = new ClientConfig();
config.getNetworkConfig().addAddress("hazelcast");
config.getNetworkConfig().setSSLConfig(new SSLConfig().setEnabled(false));
config.setGroupConfig(new GroupConfig("someGroup", "someSecret"));
HazelcastInstance instance = HazelcastClient.newHazelcastClient(config);
component.setHazelcastInstance(instance);
getContext().addComponent("hazelcast", component);
from("timer:foo?period=5000").log("Producer side: Sending data to Hazelcast topic..").process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(HazelcastConstants.OPERATION, HazelcastConstants.PUBLISH_OPERATION);
String payload = "Test " + UUID.randomUUID();
exchange.getIn().setBody(payload);
}
}).to("hazelcast:topic:foo");
from("hazelcast:topic:foo").log("Consumer side: Detected following action: $simple{in.header.CamelHazelcastListenerAction}");
}
use of com.hazelcast.core.HazelcastInstance in project hazelcast by hazelcast.
the class ClientMapProxy method aggregate.
@Override
public <SuppliedValue, Result> Result aggregate(Supplier<K, V, SuppliedValue> supplier, Aggregation<K, SuppliedValue, Result> aggregation) {
HazelcastInstance hazelcastInstance = getContext().getHazelcastInstance();
JobTracker jobTracker = hazelcastInstance.getJobTracker("hz::aggregation-map-" + name);
return aggregate(supplier, aggregation, jobTracker);
}
Aggregations