use of org.apereo.cas.hz.HazelcastConfigurationFactory in project cas by apereo.
the class CasServicesStreamingHazelcastConfiguration method casRegisteredServiceHazelcastInstance.
@Bean
public HazelcastInstance casRegisteredServiceHazelcastInstance() {
final String name = CasRegisteredServiceHazelcastStreamPublisher.class.getSimpleName();
LOGGER.debug("Creating Hazelcast instance [{}] to publish service definitions", name);
final HazelcastConfigurationFactory factory = new HazelcastConfigurationFactory();
final StreamServicesHazelcastProperties stream = casProperties.getServiceRegistry().getStream().getHazelcast();
final BaseHazelcastProperties hz = stream.getConfig();
final long duration = Beans.newDuration(stream.getDuration()).toMillis();
final MapConfig mapConfig = factory.buildMapConfig(hz, name, TimeUnit.MILLISECONDS.toSeconds(duration));
final Config cfg = factory.build(hz, mapConfig);
LOGGER.debug("Created hazelcast instance [{}] with publisher id [{}] to publish service definitions", name, casRegisteredServiceStreamPublisherIdentifier);
return Hazelcast.newHazelcastInstance(cfg);
}
use of org.apereo.cas.hz.HazelcastConfigurationFactory in project cas by apereo.
the class HazelcastTicketRegistryConfiguration method buildHazelcastMapConfigurations.
private Map<String, MapConfig> buildHazelcastMapConfigurations(final TicketCatalog ticketCatalog) {
final Map<String, MapConfig> mapConfigs = new HashMap<>();
final HazelcastTicketRegistryProperties hz = casProperties.getTicket().getRegistry().getHazelcast();
final HazelcastConfigurationFactory factory = new HazelcastConfigurationFactory();
final Collection<TicketDefinition> definitions = ticketCatalog.findAll();
definitions.forEach(t -> {
final MapConfig mapConfig = factory.buildMapConfig(hz, t.getProperties().getStorageName(), t.getProperties().getStorageTimeout());
LOGGER.debug("Created Hazelcast map configuration for [{}]", t);
mapConfigs.put(t.getProperties().getStorageName(), mapConfig);
});
return mapConfigs;
}
use of org.apereo.cas.hz.HazelcastConfigurationFactory in project cas by apereo.
the class HazelcastTicketRegistryConfiguration method getConfig.
private Config getConfig(final TicketCatalog ticketCatalog) {
final HazelcastTicketRegistryProperties hz = casProperties.getTicket().getRegistry().getHazelcast();
final Map<String, MapConfig> configs = buildHazelcastMapConfigurations(ticketCatalog);
final HazelcastConfigurationFactory factory = new HazelcastConfigurationFactory();
return factory.build(hz, configs);
}
Aggregations