Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bean scopes. #3

Merged
merged 1 commit into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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