0

I have been using Spring Cloud Stream with Kafka for a while now. I have a sample SCS-Producer which pumps out data to an output topic.

Below is my producer code:-

@EnableBinding(Source.class)
public class SampleProducer {


      @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "7000", maxMessagesPerPoll = "1"))
public Employee MessageSource() {

Employee emp = new Employee();
emp.setName("Jack");
emp.setType("Dev");

return emp;
}
}

2) App.yml

spring:
  cloud:
    stream:
      defaultBinder: kafka
      bindings:
        output:
          destination: topic1
          content-type: application/json
      kafka:
        binder:
          brokers: someIp:somePort
          zkNodes: someIp:somePort
server:
  port: 0

Request:- Never deployed an AWS Application which used AWS Native services. In the above code everything works fine if I use Kafka and the app on my Local. BUT I now I need to deploy my App on EC2 Cluster, and also I have to use AWS MSK ( this is also provisioned for my team).

I have been using pipelines created by DevOps engineers until now so never really integrated anything by myself and there is very less or rather No documentation or demo projects that I helps me in this situation. I am very much stuck and I need your help. Could anyone help me to a page or a link or any resource wherein I can follow steps to 1. have all the configuration info for the provisioned AWS MSK info in my code so that I can deploy this app on AWS ? Much appreciated.

Thank you.

Kenny Weeler
  • 153
  • 1
  • 3
  • 15

1 Answers1

0

You can follow the AWS MSK official step-by-step guide here https://docs.aws.amazon.com/msk/latest/developerguide/getting-started.html and then use the same EC2 instance/machine created in step #4, to deploy your own Spring Cloud Stream app and test it.

If, by following the guide, you are able to produce and consume data as mentioned in the step #6, then your Spring Cloud Stream app should also be able to connect as well.

I didn't used Spring Cloud Stream with AWS MSK before, but I have successfully deployed and ran Spring Boot applications on EC2 and Elastic Beanstalk talking to AWS MSK cluster(s). And, in doing so, I followed the official AWS MSK documentation and it worked for me, (with just one hiccup though AWS Elastic Beanstalk unable to access AWS MSK).