Search in sources :

Example 1 with StreamServicesHazelcastProperties

use of org.apereo.cas.configuration.model.support.services.stream.hazelcast.StreamServicesHazelcastProperties 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);
}
Also used : HazelcastConfigurationFactory(org.apereo.cas.hz.HazelcastConfigurationFactory) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) StreamServicesHazelcastProperties(org.apereo.cas.configuration.model.support.services.stream.hazelcast.StreamServicesHazelcastProperties) BaseHazelcastProperties(org.apereo.cas.configuration.model.support.hazelcast.BaseHazelcastProperties) MapConfig(com.hazelcast.config.MapConfig) StringBean(org.apereo.cas.StringBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Config (com.hazelcast.config.Config)1 MapConfig (com.hazelcast.config.MapConfig)1 StringBean (org.apereo.cas.StringBean)1 BaseHazelcastProperties (org.apereo.cas.configuration.model.support.hazelcast.BaseHazelcastProperties)1 StreamServicesHazelcastProperties (org.apereo.cas.configuration.model.support.services.stream.hazelcast.StreamServicesHazelcastProperties)1 HazelcastConfigurationFactory (org.apereo.cas.hz.HazelcastConfigurationFactory)1 Bean (org.springframework.context.annotation.Bean)1