Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dartartem committed Jan 19, 2021
1 parent e03c131 commit 78482b3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import io.eventuate.messaging.kafka.basic.consumer.EventuateKafkaConsumerConfigurationProperties;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;

@ApplicationScoped
@Singleton
public class EventuateKafkaConsumerConfigurationPropertiesConfiguration {
@Produces
@Singleton
public EventuateKafkaConsumerConfigurationProperties eventuateKafkaConsumerConfigurationProperties(EventuateKafkaConsumerQuarkusConfigurationProperties eventuateKafkaConsumerQuarkusConfigurationProperties) {
EventuateKafkaConsumerConfigurationProperties eventuateKafkaConsumerConfigurationProperties = new EventuateKafkaConsumerConfigurationProperties(eventuateKafkaConsumerQuarkusConfigurationProperties.getPropertiesAsMap());
eventuateKafkaConsumerConfigurationProperties.setBackPressure(eventuateKafkaConsumerQuarkusConfigurationProperties.getBackPressure().toBackPressureConfig());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
import io.eventuate.messaging.kafka.common.EventuateKafkaConfigurationProperties;
import org.eclipse.microprofile.config.inject.ConfigProperty;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;

@ApplicationScoped
@Singleton
public class EventuateKafkaPropertiesConfiguration {

@Produces
@Singleton
public EventuateKafkaConfigurationProperties eventuateKafkaConfigurationProperties(@ConfigProperty(name = "eventuatelocal.kafka.bootstrap.servers")
String bootstrapServers,
@ConfigProperty(name = "eventuatelocal.kafka.connection.validation.timeout", defaultValue = "1000")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.eventuate.messaging.kafka.quarkus.consumer;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;

import io.eventuate.messaging.kafka.basic.consumer.DefaultKafkaConsumerFactory;
import io.eventuate.messaging.kafka.basic.consumer.KafkaConsumerFactory;
import io.quarkus.arc.DefaultBean;

@ApplicationScoped
@Singleton
public class KafkaConsumerFactoryConfiguration {
@Produces
@Singleton
@DefaultBean
public KafkaConsumerFactory kafkaConsumerFactory() {
return new DefaultKafkaConsumerFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
import io.eventuate.messaging.kafka.common.EventuateKafkaConfigurationProperties;
import io.eventuate.messaging.kafka.consumer.MessageConsumerKafkaImpl;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;

@ApplicationScoped
@Singleton
public class MessageConsumerKafkaConfiguration {
@Produces
@Singleton
public MessageConsumerKafkaImpl messageConsumerKafka(EventuateKafkaConfigurationProperties props,
EventuateKafkaConsumerConfigurationProperties eventuateKafkaConsumerConfigurationProperties,
KafkaConsumerFactory kafkaConsumerFactory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@
import io.eventuate.messaging.kafka.producer.EventuateKafkaProducer;
import io.eventuate.messaging.kafka.producer.EventuateKafkaProducerConfigurationProperties;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;

@ApplicationScoped
@Singleton
public class EventuateKafkaProducerConsumerConfiguration {
@Produces
@Singleton
public EventuateKafkaProducer producer(EventuateKafkaConfigurationProperties kafkaProperties, EventuateKafkaProducerConfigurationProperties producerProperties) {
return new EventuateKafkaProducer(kafkaProperties.getBootstrapServers(), producerProperties);
}

@Produces
@Singleton
public MessageConsumerKafkaImpl messageConsumerKafka(EventuateKafkaConfigurationProperties props,
EventuateKafkaConsumerConfigurationProperties eventuateKafkaConsumerConfigurationProperties,
KafkaConsumerFactory kafkaConsumerFactory) {
return new MessageConsumerKafkaImpl(props.getBootstrapServers(), eventuateKafkaConsumerConfigurationProperties, kafkaConsumerFactory);
}

@Produces
@Singleton
public KafkaConsumerFactory kafkaConsumerFactory() {
return new DefaultKafkaConsumerFactory();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import io.eventuate.messaging.kafka.producer.EventuateKafkaProducerConfigurationProperties;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;

@ApplicationScoped
@Singleton
public class EventuateKafkaProducerConfigurationPropertiesConfiguration {
@Produces
@Singleton
public EventuateKafkaProducerConfigurationProperties eventuateKafkaProducerConfigurationProperties(EventuateKafkaProducerQuarkusConfigurationProperties eventuateKafkaProducerQuarkusConfigurationProperties) {
return new EventuateKafkaProducerConfigurationProperties(eventuateKafkaProducerQuarkusConfigurationProperties.getPropertiesAsMap());
}
Expand Down

0 comments on commit 78482b3

Please sign in to comment.