This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface MyBeerOutput { | |
| String OUTPUT = "output"; | |
| @Output(Source.OUTPUT) | |
| MessageChannel output(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface MyBeerOutput { | |
| String OUTPUT = "output"; | |
| @Output(MyBeerOutput.OUTPUT) | |
| MessageChannel output(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #mykafka or myrabbit? | |
| spring.cloud.stream.defaultBinder = myrabbit | |
| #Target Stream for beers channel | |
| spring.cloud.stream.bindings.output.destination = beers-channel | |
| #RabbitMQ Settings: | |
| spring.cloud.stream.binders.myrabbit.type = rabbit | |
| spring.cloud.stream.binders.myrabbit.environment.spring.rabbitmq.addresses = localhost:5672 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #mykafka or myrabbit? | |
| spring.cloud.stream.defaultBinder = mykafka | |
| #Target Stream for beers channel | |
| spring.cloud.stream.bindings.output.destination = beers-channel | |
| #Kafka Settings: | |
| spring.cloud.stream.binders.mykafka.type = kafka | |
| spring.cloud.stream.binders.mykafka.environment.spring.cloud.stream.kafka.binder.brokers = localhost:9092 | |
| spring.cloud.stream.binders.mykafka.environment.spring.cloud.stream.kafka.binder.zkNodes = localhost:2181 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @SpringBootApplication | |
| @EnableBinding(Source.class) | |
| public class BeerClientApplication { | |
| public static void main(String[] args) { | |
| SpringApplication.run(BeerClientApplication.class, args); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component | |
| @Slf4j | |
| class BeerHandler { | |
| @Autowired | |
| BeerRepository repo; | |
| @StreamListener(target=Sink.INPUT) | |
| public void handleBeerMessage (String message) { | |
| log.info("Received beer: {}", message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #myrabbit or mykafka? | |
| spring.cloud.stream.defaultBinder = mykafka | |
| spring.cloud.stream.bindings.input.destination=beers-channel | |
| spring.cloud.stream.bindings.input.group = beers-group | |
| #Kafka Settings: | |
| spring.cloud.stream.binders.mykafka.type = kafka | |
| spring.cloud.stream.binders.mykafka.environment.spring.cloud.stream.kafka.binder.brokers = localhost:9092 | |
| spring.cloud.stream.binders.mykafka.environment.spring.cloud.stream.kafka.binder.zkNodes = localhost:2181 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #myrabbit or mykafka? | |
| spring.cloud.stream.defaultBinder = myrabbit | |
| spring.cloud.stream.bindings.input.destination=beers-channel | |
| spring.cloud.stream.bindings.input.group = beers-group | |
| #RabbitMQ Settings: | |
| spring.cloud.stream.binders.myrabbit.type = rabbit | |
| spring.cloud.stream.binders.myrabbit.environment.spring.rabbitmq.addresses = localhost:5672 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; | |
| import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | |
| import org.springframework.cloud.client.loadbalancer.LoadBalanced; | |
| import org.springframework.cloud.netflix.zuul.EnableZuulProxy; | |
| import org.springframework.cloud.stream.annotation.EnableBinding; | |
| import org.springframework.cloud.stream.annotation.Output; | |
| import org.springframework.cloud.stream.messaging.Source; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| import org.springframework.cloud.stream.annotation.EnableBinding; | |
| import org.springframework.cloud.stream.annotation.Output; | |
| import org.springframework.cloud.stream.messaging.Source; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; |