Skip to content

Commit

Permalink
fixes issue starting in local
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Jun 15, 2023
1 parent 6fb5bd5 commit f7e8ef8
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ HELP.md
/analytics-spring-cloud-streams-kafka-consumer/target/
/analytics-spring-cloud-streams-kafka-producer/target/
kafka-java-sample/target/
spring-kafka-sample/target/
spring-kafka-sample/target/
/logs/
7 changes: 5 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@
},
{
"type": "java",
"name": "BootKafkaReactorProducerApplication",
"name": "Spring Boot-BootKafkaReactorProducerApplication<boot-kafka-reactor-producer>",
"request": "launch",
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"mainClass": "com.example.boot.kafka.reactor.BootKafkaReactorProducerApplication",
"projectName": "boot-kafka-reactor-producer"
"projectName": "boot-kafka-reactor-producer",
"args": "--spring.profiles.active=local"
},
{
"type": "java",
Expand Down
6 changes: 6 additions & 0 deletions kafka-reactor/boot-kafka-reactor-producer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
package com.example.boot.kafka.reactor.config;

import com.example.boot.kafka.reactor.dto.MessageDTO;
import com.example.boot.kafka.reactor.util.AppConstants;
import java.util.Map;
import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
import reactor.kafka.sender.KafkaSender;
import reactor.kafka.sender.SenderOptions;

@EnableKafka
@Configuration(proxyBeanMethods = false)
public class KafkaConfiguration {

@Bean
public NewTopic myTopic() {
return new NewTopic(AppConstants.HELLO_TOPIC, 1, (short) 1);
}

@Bean
public KafkaSender<Integer, MessageDTO> reactiveKafkaSender(KafkaProperties properties) {
Map<String, Object> props = properties.buildProducerProperties();
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
spring.kafka.bootstrap-servers=localhost:9200
spring.kafka.bootstrap-servers=localhost:29200

spring.r2dbc.url=r2dbc:postgresql://localhost:5432/appdb
spring.r2dbc.username=appuser
spring.r2dbc.password=secret

spring.liquibase.url=jdbc:postgresql://localhost:5432/appdb?maxIdleTime=PT60S
spring.liquibase.user=${spring.r2dbc.username}
spring.liquibase.password=${spring.r2dbc.password}
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
################ Logging #####################
logging.file.name=logs/spring-boot-jooq-r2dbc-sample.log
logging.level.web=INFO
logging.level.sql=INFO
## To enable transaction details logging
#logging.level.org.springframework.transaction=DEBUG
#logging.level.org.springframework.data.r2dbc.connectionfactory=DEBUG

################ Actuator #####################
management.endpoints.web.exposure.include=configprops,env,health,info,logfile,loggers,metrics
management.endpoint.health.show-details=always

################ Kafka ########################
spring.kafka.bootstrap-servers=localhost:9200
# producer
spring.kafka.producer.acks=all
#spring.kafka.producer.acks=all
spring.kafka.producer.clientId=sample-producer
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.IntegerSerializer
spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonDeserializer
spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
# consumer
spring.kafka.consumer.group-id=reactivekafka
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.clientId=sample-consumer
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.IntegerDeserializer
spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer
# json deserializer config
spring.kafka.properties.spring.json.trusted.packages=*
#spring.kafka.properties.spring.json.trusted.packages=*
spring.kafka.consumer.properties.spring.json.use.type.headers=false
spring.kafka.consumer.properties.spring.json.value.default.type=com.example.boot.kafka.reactor.dto.MessageDTO

0 comments on commit f7e8ef8

Please sign in to comment.