Skip to content

Instantly share code, notes, and snippets.

View aytekin's full-sized avatar
🎯
Focusing

Aytekin Erlale aytekin

🎯
Focusing
View GitHub Profile
@aytekin
aytekin / UserService.java
Created November 18, 2021 21:44
reactor-kafka
@Service
@Slf4j
@AllArgsConstructor
public class UserService {
private final KafkaProducer kafkaProducer;
private static final String USER_TOPIC = "user-create";
public Mono<String> userCreate(Mono<UserDto> username){
return username.flatMap(name ->
@aytekin
aytekin / KafkaProducer.java
Created November 18, 2021 20:21
reactor-kafka
@Configuration
@AllArgsConstructor
public class KafkaProducer {
private static final String BOOTSTRAP_SERVERS = "localhost:9092";
/**
* Building kafka producer configurations
* */
@Bean
@aytekin
aytekin / pom.xml
Last active November 18, 2021 20:21
reactor-kafka
.
.
.
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
@Getter
@Setter
public class ProductDto {
public ProductDto(Long id, String title, BigDecimal price, String imagePath, String owner) {
this.id = id;
this.title = title;
this.price = price;
this.imagePath = imagePath;
this.owner = owner;
public class ProductService {
List<ProductDto> products = new ArrayList<ProductDto>();
ProductDto product;
public List<ProductDto> getProducts(){
return products;
}
public ProductDto get(Long id) throws ClassNotFoundException{
@aytekin
aytekin / ProductController.java
Last active December 18, 2020 18:34
Swagger
@RestController
@RequestMapping("api/product")
@AllArgsConstructor
public class ProductController {
private final ProductService productService;
@GetMapping("findAll")
public List<ProductDto> findAll() {
return productService.getProducts();