Search in sources :

Example 1 with ProtonBasedDownstreamSender

use of org.eclipse.hono.client.telemetry.amqp.ProtonBasedDownstreamSender in project hono by eclipse.

the class ApplicationConfig method eventSenderProvider.

/**
 * Creates a client for publishing events via the configured messaging systems.
 *
 * @return The client.
 */
@Bean
@Scope("prototype")
public MessagingClientProvider<EventSender> eventSenderProvider() {
    final MessagingClientProvider<EventSender> result = new MessagingClientProvider<>();
    if (downstreamSenderConfig().isHostConfigured()) {
        result.setClient(new ProtonBasedDownstreamSender(HonoConnection.newConnection(vertx(), downstreamSenderConfig(), tracer()), SendMessageSampler.Factory.noop(), true, true));
    }
    if (kafkaEventConfig().isConfigured()) {
        final KafkaProducerFactory<String, Buffer> factory = CachingKafkaProducerFactory.sharedFactory(vertx());
        result.setClient(new KafkaBasedEventSender(vertx(), factory, kafkaEventConfig(), true, tracer()));
    }
    healthCheckServer().registerHealthCheckResources(ServiceClientAdapter.forClient(result));
    return result;
}
Also used : Buffer(io.vertx.core.buffer.Buffer) MessagingClientProvider(org.eclipse.hono.client.util.MessagingClientProvider) ProtonBasedDownstreamSender(org.eclipse.hono.client.telemetry.amqp.ProtonBasedDownstreamSender) KafkaBasedEventSender(org.eclipse.hono.client.telemetry.kafka.KafkaBasedEventSender) EventSender(org.eclipse.hono.client.telemetry.EventSender) KafkaBasedEventSender(org.eclipse.hono.client.telemetry.kafka.KafkaBasedEventSender) Scope(org.springframework.context.annotation.Scope) ObjectFactoryCreatingFactoryBean(org.springframework.beans.factory.config.ObjectFactoryCreatingFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with ProtonBasedDownstreamSender

use of org.eclipse.hono.client.telemetry.amqp.ProtonBasedDownstreamSender in project hono by eclipse.

the class AmqpServerFactory method eventSenderProvider.

/**
 * Creates a client for publishing events via the configured messaging systems.
 *
 * @return The client.
 */
private MessagingClientProvider<EventSender> eventSenderProvider() {
    final MessagingClientProvider<EventSender> result = new MessagingClientProvider<>();
    if (downstreamSenderConfig.isHostConfigured()) {
        result.setClient(new ProtonBasedDownstreamSender(HonoConnection.newConnection(vertx, downstreamSenderConfig, tracer), SendMessageSampler.Factory.noop(), true, true));
    }
    if (eventKafkaProducerConfig.isConfigured()) {
        final KafkaProducerFactory<String, Buffer> factory = CachingKafkaProducerFactory.sharedFactory(vertx);
        result.setClient(new KafkaBasedEventSender(vertx, factory, eventKafkaProducerConfig, true, tracer));
    }
    healthCheckServer.registerHealthCheckResources(ServiceClientAdapter.forClient(result));
    return result;
}
Also used : Buffer(io.vertx.core.buffer.Buffer) MessagingClientProvider(org.eclipse.hono.client.util.MessagingClientProvider) ProtonBasedDownstreamSender(org.eclipse.hono.client.telemetry.amqp.ProtonBasedDownstreamSender) KafkaBasedEventSender(org.eclipse.hono.client.telemetry.kafka.KafkaBasedEventSender) EventSender(org.eclipse.hono.client.telemetry.EventSender) KafkaBasedEventSender(org.eclipse.hono.client.telemetry.kafka.KafkaBasedEventSender)

Example 3 with ProtonBasedDownstreamSender

use of org.eclipse.hono.client.telemetry.amqp.ProtonBasedDownstreamSender in project hono by eclipse.

the class AmqpServerFactory method eventSenderProvider.

/**
 * Creates a client for publishing events via the configured messaging systems.
 *
 * @return The client.
 */
private MessagingClientProvider<EventSender> eventSenderProvider() {
    final MessagingClientProvider<EventSender> result = new MessagingClientProvider<>();
    if (downstreamSenderConfig.isHostConfigured()) {
        result.setClient(new ProtonBasedDownstreamSender(HonoConnection.newConnection(vertx, downstreamSenderConfig, tracer), SendMessageSampler.Factory.noop(), true, true));
    }
    if (eventKafkaProducerConfig.isConfigured()) {
        final KafkaProducerFactory<String, Buffer> factory = CachingKafkaProducerFactory.sharedFactory(vertx);
        result.setClient(new KafkaBasedEventSender(vertx, factory, eventKafkaProducerConfig, true, tracer));
    }
    healthCheckServer.registerHealthCheckResources(ServiceClientAdapter.forClient(result));
    return result;
}
Also used : Buffer(io.vertx.core.buffer.Buffer) MessagingClientProvider(org.eclipse.hono.client.util.MessagingClientProvider) ProtonBasedDownstreamSender(org.eclipse.hono.client.telemetry.amqp.ProtonBasedDownstreamSender) KafkaBasedEventSender(org.eclipse.hono.client.telemetry.kafka.KafkaBasedEventSender) EventSender(org.eclipse.hono.client.telemetry.EventSender) KafkaBasedEventSender(org.eclipse.hono.client.telemetry.kafka.KafkaBasedEventSender)

Aggregations

Buffer (io.vertx.core.buffer.Buffer)3 EventSender (org.eclipse.hono.client.telemetry.EventSender)3 ProtonBasedDownstreamSender (org.eclipse.hono.client.telemetry.amqp.ProtonBasedDownstreamSender)3 KafkaBasedEventSender (org.eclipse.hono.client.telemetry.kafka.KafkaBasedEventSender)3 MessagingClientProvider (org.eclipse.hono.client.util.MessagingClientProvider)3 ObjectFactoryCreatingFactoryBean (org.springframework.beans.factory.config.ObjectFactoryCreatingFactoryBean)1 Bean (org.springframework.context.annotation.Bean)1 Scope (org.springframework.context.annotation.Scope)1