Sign inSign up

onesaitplatform/edge-kafka

By onesaitplatform

Updated about 7 years ago

One of the most simple and flexible ways to communicate Onesait Platform Things devices

Image
0

81

onesaitplatform/edge-kafka repository overview

Java Kafka Client App

To get more information about Kafka application: kafka documentation

##Environments Followings environments are used to configure kafka client to connect with the platform:

  • CONTAINER_TIMEZONE: container timezone.
  • KAFKA_URL: platform connection url
  • KAFKA_PORT: platform connection port
  • KAFKA_TOKEN: connection token provided by the platform
  • KAFKA_CLIENT_PLATFORM: client name provided by the platform
  • KAFKA_PREFIX: ontology prefix provided by the platform
  • KAFKA_ONTOLOGY: ontology defined into platform
  • KAFKA_RESEND_MESSAGES: number of messages to resend at once when connection is restored.
  • KAFKA_RESEND_PERSISTENCE_H: max time in hours to store messages when connection is lost.
  • KAFKA_RESEND_SEC: resend messages time (in seconds)
  • MQTT_TOPIC: mqtt topic to receive messages from producer container (modbus, zigbee, bacnet, etc...)

docker

To run kafka container you can execute following command:

docker run -d -it   -v /mnt/logs -v /mnt/data  \
-e "CONTAINER_TIMEZONE: Europe/Madrid"   \
-e "KAFKA_URL=onesaitplatform.online"  \
-e "KAFKA_PORT=9095"   \
-e "KAFKA_TOKEN=e501b0b0358f45ff9181346d14e2de49"  \
-e "KAFKA_CLIENT_PLATFORM=Ejemplo_Kafka_23"  \
-e "KAFKA_PREFIX=ONTOLOGY_"  \
-e "KAFKA_ONTOLOGY=EdgeFeedWoT"  \
-e "KAFKA_RESEND_MESSAGES=100"  \
-e "KAFKA_RESEND_PERSISTENCE_H=24"  \
-e "KAFKA_RESEND_SEC=10"  \
-e "MQTT_TOPIC=kafka_topic"  \
--restart always --name edge.kafka onesaitplatform/edge-kafka:community

docker-compose

Another way to launch database application is to use docker-compose schema; docker-compose.yml file must be located at the same execution directory .

running docker-compose
docker-compose pull
docker-compose up -d
docker-compose.yml configuration file
version: '2'

services:

  mqtt:
    restart: always
    image: onesaitplatform/edge-mqtt:community
    container_name: edge.mqtt
    volumes:
      - /home/indra/docker/logs:/mosquitto/log
      - /home/indra/docker/data:/mosquitto/data
    networks:
      - edgenet

  kafka:
    restart: always
    image: onesaitplatform/edge-kafka:community
    container_name: edge.kafka
    environment:
      CONTAINER_TIMEZONE: Europe/Madrid
      KAFKA_URL: onesaitplatform.online
      KAFKA_PORT: 9095
      KAFKA_TOKEN: f846e4089d7f4f1fb635b5da5e3ec898
      KAFKA_CLIENT_PLATFORM: KafkaInserts
      KAFKA_PREFIX: ONTOLOGY_
      KAFKA_ONTOLOGY: EdgeModbus
      KAFKA_RESEND_MESSAGES: 100
      KAFKA_RESEND_PERSISTENCE_H: 24
      KAFKA_RESEND_SEC: 10
      MQTT_TOPIC: /node1/kafka
    volumes:
      - /mnt/logs
      - /mnt/data
    depends_on:
      - mqtt
    links:
      - mqtt
    networks:
      - edgenet

networks:
  edgenet:
    driver:  bridge


Tag summary

Content type

Image

Digest

Size

68.8 MB

Last updated

about 7 years ago

docker pull onesaitplatform/edge-kafka:community