0

I am picking Json data from one topic, converting it to Avro format and then sending it to another topic using kafka streams.

For that I compiled Notification.avsc ( avro schema file ) using maven and I got Notification.java file under folder
target/generated-sources/com/kafkastreams/examples/kafka/model.

Now I want to use this file in my program. But I could not import it. I tried writting import address manually also but getting error as

The import com.kafkastreams.examples.kafka.model cannot be resolved

Where am I wrong ?
I am using Visual studio code.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
tushar
  • 313
  • 4
  • 10
  • Are you sure vscode knows that `target/generated-sources` should be included on the compiler classpath? In Intellij/Eclipse, you sometimes have to manually set that up – OneCricketeer Jun 03 '21 at 13:04
  • Can you share the `Notification.java` and describe how to use it for me to reproduce your question? – Molly Wang-MSFT Jun 04 '21 at 01:24
  • @MollyWang I assume you mean Notification.avsc? The Java file is generated https://avro.apache.org/docs/1.8.2/gettingstartedjava.html – OneCricketeer Jun 04 '21 at 20:10
  • @OneCricketeer I did not find any help regarding VS Code. So I switched to Intellij and found this link [link](https://stackoverflow.com/questions/854264/how-to-add-directory-to-classpath-in-an-application-run-profile-in-intellij-idea#:~:text=find%20your%20project%20or%20sub,your%20path%20and%20click%20OK) but still my problem persist. Can you help me in Intellij ? – tushar Jun 06 '21 at 05:26
  • 1
    Assuming you're using Maven or Gradle, `target/generated-sources` should work if you try to compile the code. You can also modify the plugin definition to change the output directory of the files to be in src with the rest of the files, for example – OneCricketeer Jun 06 '21 at 12:09
  • 1
    @OneCricketeer I changed the output directory and it worked. Thank you. Now I can go back to VS Code :) Hey I have a one more question. To learn kafka connect , confluent schema registry , security , Ksql does require spring boot ? I did not find any material of this using spring boot ? – tushar Jun 08 '21 at 05:20
  • None of that requires or uses Spring at all – OneCricketeer Jun 08 '21 at 05:21
  • @OneCricketeer When a fresher says , I know Kafka, should he know everyting ( schema, security, ksql etc ) or Stream is enough ? – tushar Jun 08 '21 at 05:25
  • I don't know what a "Fresher" is, or what you're trying to ask . You can be an expert in KStreams and understand the Serde classes/interfaces and never know anything about how to install or maintain Kafka brokers, never use Connect, or ever touch Confluent Platform or a Schema Registry... Similarly, you can be very knowledgeable about Producer/Consumer or how to monitor and secure a Kafka cluster and never use Streams API or touch KSQL – OneCricketeer Jun 08 '21 at 05:28
  • @OneCricketeer Sorry,. I wanted to say, I dont have industry experience. I want to be backend engineer. I learnt microservices, and found that, kafka is used in microservice communication. So I learnt basic of kafka. Now I found it interesting but dont know, inexperiance person should go for those advance kafka module or not ? Can you guide me ? – tushar Jun 08 '21 at 05:36
  • Kafka is just one technology. And not required for industry experience. I cannot and Stackoverflow is not the appropriate place to do so. Pickup the Kafka Definitive Guide book or one about Kafka Streams. Follow the Confluent blog or Github example repos. Build projects on your own... – OneCricketeer Jun 08 '21 at 05:39
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/233481/discussion-between-tushar-and-onecricketeer). – tushar Jun 08 '21 at 05:40

0 Answers0