Skip to content

raiRaiyan/netlogo-kafka-extension

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NetLog kafka Extension

Stream events from your NetLogo model to a kafa topic. You can connect to a kafka cluster and push to any topic in the cluster.

Kafka accepts data in the key:value format. This extension lets the user provide both the key and value in String format. No other data type is supported in this version.

Currently, you can only push to one kafka cluster from your simulation.

Updates

Version 2.0 (September 10 2018)
  • The primitives have been renamed for better understanding and easier use
  • Introduction of asyc 'send' primitives for faster throughput (Fire and forget)

Available primitives (Version 2.0)

  • start-kafka-producer list_of_brokers(comma-separated) default_topic
  • stop-kafka-producer
  • send key value
  • send-to-topic topic key value
  • send-async key value
  • send-to-topic-async topic key value

kafka-message primitive streams data to the default_topic defined when the start-kafka-producer is used

If you want to stream data to a different topic than the default one use kafka-message-to-topic primitive.

Downloads

You can download the jar from IRD archiva. User your I&D credentials to download.

How to add this extension to NetLogo

  1. Download the jar.
  2. Create a folder called 'kafka-producer' in app/extensions directory of your NetLogo installation.
  3. Copy the jar to that folder and rename it to kafka-producer.jar

You can now use kafka-producer extension in your simulation

Using it in Simulation

;; declare extension
extensions [
  kafka-producer
]

;;setup kafka on init.
to setup-kafka
  kafka-producer:start-kafka-producer "localhost:9092" "netLogo"
end


;; push message to topic "netLogo"
to push-message
   kafka-producer:kafka-message (word self) (word date-and-time "hello")
end

;; stop the producer when simulation is done
to stop-kafa
   kafka-producer:stop-kafka-producer
end

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%