use of org.apereo.cas.kafka.KafkaObjectFactory in project cas by apereo.
the class CasServicesStreamingKafkaConfiguration method registeredServiceDistributedKafkaTemplate.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public KafkaOperations<String, DistributedCacheObject<RegisteredService>> registeredServiceDistributedKafkaTemplate(final ConfigurableApplicationContext applicationContext, final CasConfigurationProperties casProperties) {
return BeanSupplier.of(KafkaOperations.class).when(CONDITION.given(applicationContext.getEnvironment())).supply(() -> {
val kafka = casProperties.getServiceRegistry().getStream().getKafka();
val mapper = new RegisteredServiceJsonSerializer().getObjectMapper();
val factory = new KafkaObjectFactory<String, DistributedCacheObject<RegisteredService>>(kafka.getBootstrapAddress());
return factory.getKafkaTemplate(new StringSerializer(), new JsonSerializer<>(mapper));
}).otherwiseProxy().get();
}
use of org.apereo.cas.kafka.KafkaObjectFactory in project cas by apereo.
the class CasServicesStreamingKafkaConfiguration method registeredServiceDistributedKafkaAdmin.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "registeredServiceDistributedKafkaAdmin")
public KafkaAdminOperations registeredServiceDistributedKafkaAdmin(final ConfigurableApplicationContext applicationContext, final CasConfigurationProperties casProperties) {
return BeanSupplier.of(KafkaAdminOperations.class).when(CONDITION.given(applicationContext.getEnvironment())).supply(() -> {
val kafka = casProperties.getServiceRegistry().getStream().getKafka();
val factory = new KafkaObjectFactory<String, DistributedCacheObject<RegisteredService>>(kafka.getBootstrapAddress());
return factory.getKafkaAdmin();
}).otherwiseProxy().get();
}
use of org.apereo.cas.kafka.KafkaObjectFactory in project cas by apereo.
the class CasServicesStreamingKafkaConfiguration method registeredServiceKafkaListenerContainerFactory.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "registeredServiceKafkaListenerContainerFactory")
public ConcurrentKafkaListenerContainerFactory<String, DistributedCacheObject> registeredServiceKafkaListenerContainerFactory(final CasConfigurationProperties casProperties) {
val kafka = casProperties.getServiceRegistry().getStream().getKafka();
val factory = new KafkaObjectFactory<String, DistributedCacheObject>(kafka.getBootstrapAddress());
factory.setConsumerGroupId("registeredServices");
val mapper = new RegisteredServiceJsonSerializer().getObjectMapper();
return factory.getKafkaListenerContainerFactory(new StringDeserializer(), new JsonDeserializer<>(DistributedCacheObject.class, mapper));
}
Aggregations