Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mu-sigma/netlogo-kafka-extension
https://github.com/mu-sigma/netlogo-kafka-extension
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mu-sigma/netlogo-kafka-extension
- Owner: Mu-Sigma
- License: other
- Created: 2018-10-30T13:14:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-07-01T21:24:35.000Z (over 2 years ago)
- Last Synced: 2024-11-22T17:51:05.578Z (2 months ago)
- Language: Java
- Size: 11.7 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
## Introduction
### Objective of NetLogo kafka Extension
This netlogo extension lets you 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 usedIf you want to stream data to a different topic than the default one use
**kafka-message-to-topic** primitive.## Usage
### Build
1. Clone the project. You would need Java and Maven before you proceed
2. Run
```
mvn clean install
```
3. The target folder should have `kafka-producer-jar-with-dependencies.jar`### Add extension to NetLogo
1. Create a folder called 'kafka-producer' in app/extensions directory of your
NetLogo installation.
2. Copy the jar to that folder and rename it to kafka-producer.jarYou 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
```