Skip to content

instaclustr/groovy-kafka-protobuf-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Groovy+Kafka+Protobuf Example

This repository contains an example Kafka consumer and producer written in Groovy that handle Protobuf encoded messages.

Usage

  1. Compile the .proto files into a JAR:

    cd proto && mvn package

    This will output proto/target/proto-0.1.1-SNAPSHOT.jar

  2. Run the consumer Groovy script:

    groovy -cp proto/target/proto-0.1.1-SNAPSHOT.jar groovy/src/consumer.groovy
  3. Run the producer Groovy script:

    groovy -cp proto/target/proto-0.1.1-SNAPSHOT.jar groovy/src/producer.groovy "Hello World"

If everything works correctly you should see message field from the ExampleMessage Protobuf displayed by the consumer:

groovy -cp proto/target/proto-0.1.1-SNAPSHOT.jar groovy/src/groovy/consumer.groovy
got message: Hello World

Releases

No releases published

Packages

No packages published

Languages