use of org.eclipse.hono.client.notification.kafka.KafkaBasedNotificationReceiver in project hono by eclipse.
the class DeviceRegistryNotificationsIT method testReceiveNotificationViaKafka.
/**
* Verifies that Kafka-based notifications for adding tenant/device/credentials resources are received by a local
* client.
*
* @param ctx The vert.x test context.
* @throws InterruptedException if test is interrupted while running.
*/
@Test
@AssumeMessagingSystem(type = MessagingType.kafka)
public void testReceiveNotificationViaKafka(final VertxTestContext ctx) throws InterruptedException {
final var notificationConsumerConfig = new NotificationKafkaConsumerConfigProperties();
notificationConsumerConfig.setConsumerConfig(IntegrationTestSupport.getKafkaConsumerConfig().getConsumerConfig("notification-receiver"));
receiver = new KafkaBasedNotificationReceiver(vertx, notificationConsumerConfig);
testReceiveNotification(ctx);
}
use of org.eclipse.hono.client.notification.kafka.KafkaBasedNotificationReceiver in project hono by eclipse.
the class AbstractProtocolAdapterApplication method notificationReceiver.
/**
* Creates the notification receiver.
*
* @return The bean instance.
*/
public NotificationReceiver notificationReceiver() {
final NotificationReceiver notificationReceiver;
if (kafkaNotificationConfig.isConfigured()) {
notificationReceiver = new KafkaBasedNotificationReceiver(vertx, kafkaNotificationConfig);
} else {
final ClientConfigProperties notificationConfig = new ClientConfigProperties(downstreamSenderConfig);
notificationConfig.setServerRole("Notification");
notificationReceiver = new ProtonBasedNotificationReceiver(HonoConnection.newConnection(vertx, notificationConfig, tracer));
}
NotificationConstants.DEVICE_REGISTRY_NOTIFICATION_TYPES.forEach(notificationType -> {
notificationReceiver.registerConsumer(notificationType, notification -> {
NotificationEventBusSupport.sendNotification(vertx, notification);
});
});
return notificationReceiver;
}
use of org.eclipse.hono.client.notification.kafka.KafkaBasedNotificationReceiver in project hono by eclipse.
the class Application method notificationReceiver.
/**
* Creates the notification receiver.
*
* @return The bean instance.
*/
public NotificationReceiver notificationReceiver() {
final NotificationReceiver notificationReceiver;
if (kafkaNotificationConfig.isConfigured()) {
notificationReceiver = new KafkaBasedNotificationReceiver(vertx, kafkaNotificationConfig);
} else {
final ClientConfigProperties notificationConfig = new ClientConfigProperties(commandConsumerConnectionConfig);
notificationConfig.setServerRole("Notification");
notificationReceiver = new ProtonBasedNotificationReceiver(HonoConnection.newConnection(vertx, notificationConfig, tracer));
}
NotificationConstants.DEVICE_REGISTRY_NOTIFICATION_TYPES.forEach(notificationType -> {
notificationReceiver.registerConsumer(notificationType, notification -> {
NotificationEventBusSupport.sendNotification(vertx, notification);
});
});
return notificationReceiver;
}
Aggregations