use of org.eclipse.hono.client.util.ServiceClient in project hono by eclipse.
the class NotificationSenderProducer method notificationSender.
@Produces
@Singleton
NotificationSender notificationSender(final Vertx vertx, final Tracer tracer, final HealthCheckServer healthCheckServer, @Named("amqp-messaging-network") final ClientConfigProperties downstreamSenderConfig, final NotificationKafkaProducerConfigProperties kafkaProducerConfig) {
final NotificationSender notificationSender;
if (kafkaProducerConfig.isConfigured()) {
notificationSender = new KafkaBasedNotificationSender(CachingKafkaProducerFactory.sharedFactory(vertx), kafkaProducerConfig);
} else {
notificationSender = new ProtonBasedNotificationSender(HonoConnection.newConnection(vertx, downstreamSenderConfig, tracer));
}
if (notificationSender instanceof ServiceClient) {
healthCheckServer.registerHealthCheckResources(ServiceClientAdapter.forClient((ServiceClient) notificationSender));
}
NotificationConstants.DEVICE_REGISTRY_NOTIFICATION_TYPES.forEach(notificationType -> {
NotificationEventBusSupport.registerConsumer(vertx, notificationType, notificationSender::publish);
});
return notificationSender;
}
use of org.eclipse.hono.client.util.ServiceClient in project hono by eclipse.
the class ApplicationConfig method notificationSender.
/**
* Exposes a notification sender.
*
* @return The bean instance.
*/
@Bean
@Profile(Profiles.PROFILE_REGISTRY_MANAGEMENT)
public NotificationSender notificationSender() {
final NotificationSender notificationSender;
final var kafkaProducerConfig = notificationKafkaProducerConfig();
if (kafkaProducerConfig.isConfigured()) {
notificationSender = new KafkaBasedNotificationSender(CachingKafkaProducerFactory.sharedFactory(vertx()), kafkaProducerConfig);
} else {
notificationSender = new ProtonBasedNotificationSender(HonoConnection.newConnection(vertx(), downstreamSenderConfig(), tracer()));
}
if (notificationSender instanceof ServiceClient) {
healthCheckServer().registerHealthCheckResources(ServiceClientAdapter.forClient((ServiceClient) notificationSender));
}
NotificationConstants.DEVICE_REGISTRY_NOTIFICATION_TYPES.forEach(notificationType -> {
NotificationEventBusSupport.registerConsumer(vertx(), notificationType, notificationSender::publish);
});
return notificationSender;
}
use of org.eclipse.hono.client.util.ServiceClient in project hono by eclipse.
the class NotificationSenderProducer method notificationSender.
@Produces
@Singleton
NotificationSender notificationSender(final Vertx vertx, final Tracer tracer, final HealthCheckServer healthCheckServer, @Named("amqp-messaging-network") final ClientConfigProperties downstreamSenderConfig, final NotificationKafkaProducerConfigProperties kafkaProducerConfig) {
final NotificationSender notificationSender;
if (kafkaProducerConfig.isConfigured()) {
notificationSender = new KafkaBasedNotificationSender(CachingKafkaProducerFactory.sharedFactory(vertx), kafkaProducerConfig);
} else {
notificationSender = new ProtonBasedNotificationSender(HonoConnection.newConnection(vertx, downstreamSenderConfig, tracer));
}
if (notificationSender instanceof ServiceClient) {
healthCheckServer.registerHealthCheckResources(ServiceClientAdapter.forClient((ServiceClient) notificationSender));
}
NotificationConstants.DEVICE_REGISTRY_NOTIFICATION_TYPES.forEach(notificationType -> {
NotificationEventBusSupport.registerConsumer(vertx, notificationType, notificationSender::publish);
});
return notificationSender;
}
Aggregations