https://github.com/fabryprog/iota-kafka-gateway
IOTA ZMQ TX Listener to Kafka Topic
https://github.com/fabryprog/iota-kafka-gateway
Last synced: about 2 months ago
JSON representation
IOTA ZMQ TX Listener to Kafka Topic
- Host: GitHub
- URL: https://github.com/fabryprog/iota-kafka-gateway
- Owner: Fabryprog
- License: apache-2.0
- Created: 2020-03-20T07:51:34.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-09-29T22:21:36.000Z (over 1 year ago)
- Last Synced: 2025-02-12T08:57:12.077Z (4 months ago)
- Language: Java
- Size: 20.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IOTA Kafka Gateway
This class implements a listener for IOTA Transactions (from ZMQ IOTA Node) to Kafka Topic
Note: Every transactions are converted into an AvroRecord with following schema
```json
{
"type": "record",
"namespace": "org.fabryprog.iota.kafka.pojo",
"name": "Transaction",
"version": "1",
"fields": [
{ "name": "hash", "type": "string", "doc": "Transaction Hash" },
{ "name": "address", "type": "string", "doc": "Address" },
{ "name": "value", "type": "long", "doc": "Transaction value" },
{ "name": "tag", "type": "string", "doc": "TAG" },
{ "name": "timestamp", "type": "long", "doc": "Timestamp" },
{ "name": "payload", "type": "string", "doc": "Payload" }
]
}
```## USAGE
## Usage nested MainClass
The jar file (create with maven package lifecycle phase) uses a config file called **application.conf** (use -Dconfig.file=path/to/application.conf)
The config file must be equals below:
```hocon
# KAFKA
kafka {
bootstrapServers = "kafka-broker-one:9092,kafka-broker-two:9092,kafka-broker-three:9092"
schemaRegistry = "http://kafka-registry:8081"
topic = "iota-gateway"
topicKey = "TAG"
}# IOTA
# visit https://iota-nodes.net/
zmq="tcp://ultranode.iotatoken.nl:5556"# MISC
debug=false
```## Usage the Java API
**IotaTransactionGateway** class parameters are:
- Kafka Properties
- IOTA ZMQ node URL
- Kafka Topic Name
- Kafka Key value
- debug mode (default false)
The method **run()** could be use to start transaction's listening```java
package org.fabryprog.iota.kafka;import java.util.Properties;
public class MainClass {
public static void main(String args[]) {
Properties props = new Properties();
props.put("bootstrap.servers", "kafka-broker-one:9092,kafka-broker-two:9092,kafka-broker-three:9092");
props.put("schema.registry.url", "http://kafka-registry:8081");
// N.B. IOTA ZMQ Public node: https://iota-nodes.net/
new IotaTransactionGateway(props, "tcp://ultranode.iotatoken.nl:5556", "iota-gateway", KeyEnum.HASH, true).run();
}
}
```