Search in sources :

Example 1 with ProtonBasedNotificationReceiver

use of org.eclipse.hono.client.notification.amqp.ProtonBasedNotificationReceiver 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;
}
Also used : KafkaBasedNotificationReceiver(org.eclipse.hono.client.notification.kafka.KafkaBasedNotificationReceiver) ProtonBasedNotificationReceiver(org.eclipse.hono.client.notification.amqp.ProtonBasedNotificationReceiver) NotificationReceiver(org.eclipse.hono.notification.NotificationReceiver) KafkaBasedNotificationReceiver(org.eclipse.hono.client.notification.kafka.KafkaBasedNotificationReceiver) ClientConfigProperties(org.eclipse.hono.config.ClientConfigProperties) KafkaAdminClientConfigProperties(org.eclipse.hono.client.kafka.KafkaAdminClientConfigProperties) RequestResponseClientConfigProperties(org.eclipse.hono.client.RequestResponseClientConfigProperties) ProtonBasedNotificationReceiver(org.eclipse.hono.client.notification.amqp.ProtonBasedNotificationReceiver)

Example 2 with ProtonBasedNotificationReceiver

use of org.eclipse.hono.client.notification.amqp.ProtonBasedNotificationReceiver in project hono by eclipse.

the class DeviceRegistryNotificationsIT method testReceiveNotificationViaAmqp.

/**
 * Verifies that AMQP-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.amqp)
public void testReceiveNotificationViaAmqp(final VertxTestContext ctx) throws InterruptedException {
    final ClientConfigProperties messagingNetworkProperties = IntegrationTestSupport.getMessagingNetworkProperties();
    // use user that may open receiver links on "notification/*" addresses
    messagingNetworkProperties.setUsername(NOTIFICATION_TEST_USER);
    messagingNetworkProperties.setPassword(NOTIFICATION_TEST_PWD);
    receiver = new ProtonBasedNotificationReceiver(HonoConnection.newConnection(vertx, messagingNetworkProperties));
    testReceiveNotification(ctx);
}
Also used : ClientConfigProperties(org.eclipse.hono.config.ClientConfigProperties) ProtonBasedNotificationReceiver(org.eclipse.hono.client.notification.amqp.ProtonBasedNotificationReceiver) Test(org.junit.jupiter.api.Test) AssumeMessagingSystem(org.eclipse.hono.tests.AssumeMessagingSystem)

Example 3 with ProtonBasedNotificationReceiver

use of org.eclipse.hono.client.notification.amqp.ProtonBasedNotificationReceiver 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;
}
Also used : KafkaBasedNotificationReceiver(org.eclipse.hono.client.notification.kafka.KafkaBasedNotificationReceiver) ProtonBasedNotificationReceiver(org.eclipse.hono.client.notification.amqp.ProtonBasedNotificationReceiver) NotificationReceiver(org.eclipse.hono.notification.NotificationReceiver) KafkaBasedNotificationReceiver(org.eclipse.hono.client.notification.kafka.KafkaBasedNotificationReceiver) ClientConfigProperties(org.eclipse.hono.config.ClientConfigProperties) KafkaAdminClientConfigProperties(org.eclipse.hono.client.kafka.KafkaAdminClientConfigProperties) RequestResponseClientConfigProperties(org.eclipse.hono.client.RequestResponseClientConfigProperties) ProtonBasedNotificationReceiver(org.eclipse.hono.client.notification.amqp.ProtonBasedNotificationReceiver)

Aggregations

ProtonBasedNotificationReceiver (org.eclipse.hono.client.notification.amqp.ProtonBasedNotificationReceiver)3 ClientConfigProperties (org.eclipse.hono.config.ClientConfigProperties)3 RequestResponseClientConfigProperties (org.eclipse.hono.client.RequestResponseClientConfigProperties)2 KafkaAdminClientConfigProperties (org.eclipse.hono.client.kafka.KafkaAdminClientConfigProperties)2 KafkaBasedNotificationReceiver (org.eclipse.hono.client.notification.kafka.KafkaBasedNotificationReceiver)2 NotificationReceiver (org.eclipse.hono.notification.NotificationReceiver)2 AssumeMessagingSystem (org.eclipse.hono.tests.AssumeMessagingSystem)1 Test (org.junit.jupiter.api.Test)1