Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

Commit

Permalink
add topic creation to controller
Browse files Browse the repository at this point in the history
  • Loading branch information
bonifaido committed Nov 5, 2019
1 parent dbbfb5c commit ec589cf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/banzaicloud/spotguide/KafkaController.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.banzaicloud.spotguide;

import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.kafka.annotation.KafkaListener;
Expand Down Expand Up @@ -43,4 +45,9 @@ public List<String> listMessages() {
public void consume(String message) {
messages.add(message);
}

@Bean
public NewTopic newTopic() {
return new NewTopic(BOOT_TOPIC, 1, (short) 1);
}
}

0 comments on commit ec589cf

Please sign in to comment.