SlideShare a Scribd company logo
1 of 24
Download to read offline
Integrating Sparkplug IoT EoN Nodes with
Kafka - A Real-world Example
Yves Kurz – PAUL Tech AG
Outline
16.05.23 3
What does PAUL do? 3
IoT Architecture @ PAUL 9
MQTT Primer 12
Introduction to Sparkplug 13
Connecting IoT and Kafka 15
Do‘s and Don‘ts 24
4
In 2023 PAUL will save ~ 21‘500 Tons of CO₂!
To compensate that amount of CO₂ it would need an area of 10’000 sqm of forest or…
… ~80% the size of Airport Heathrow! … ~3x the size of Central Park! … ~4x the size of Disneyland California!
What does PAUL do?
PAUL implements the adaptive hydraulic balancing in drinking water systems and heating.
16.05.23 5
PAUL
Smart Valve
PAUL
Gateway
PAUL
Temperature Sensor
PAUL
Energy Valve
What does PAUL do?
PAUL implements the adaptive hydraulic balancing in drinking water systems and heating.
16.05.23 6
The optimization through PAUL's AI and its advantages
AI technology analyzes the current state of the entire system and optimizes it
Consumption
Behaviour
Vacancy
Weather
Sun side
orientation
Day time /
Season
Combines billions of data
points from other houses.
PAUL AI
ADVANTAGES
Up to 40% energy savings!
Optimization of ESG ratings!
More attractive interest rates
for refinancing!
Sizing of new heating systems
based on consumption data
instead of assumptions!
Perfect preparation for the use
of alternative heat generators!
16.05.23 7
PAUL Tech AG in Numbers
16.05.23 8
4 Offices: Mannheim, Nürnberg, Jacksonville, Bern
>130 Employees
2017 Year of Establishment
>150‘000 Residential Units
>500‘000‘000 Data Points
https://www.paul.tech/en/career
PAUL’s Legacy Architecture 2017-2022
16.05.23 9
l Traditional Industrial Automation Architecture
l Expensive
l Does not scale
l Hard to maintain
Input Output
PLC
SCADA/Supervisory
Reporting
AWS
Field
Level
New Architecture 2022-
16.05.23 10
AWS
Field
Level
Control Center &
Dashboarding Services
Kafka
IoT Services
Kafka Connect
MQTT Broker
l Concept and architecture validation from Oct ‘21 –
March’22
l Implementation May ’22-
l In productive use since Dec ‘22
l No PLC and SCADA system
l Router is Sparkplug EoN node
l From Polling to Report by Exception
Covered in this Session
16.05.23 11
AWS
Field
Level
Control Center &
Dashboarding Services
Kafka
IoT Services
Kafka Connect
MQTT Broker
l MQTT - Transport Protocol between Edge Nodes
l Sparkplug – MQTT Topic and Payload Definition
l Kafka Connect – Bridging MQTT and Kafka
MQTT Primer
16.05.23 12
l Message Queuing Telemetry Transport
l Lightweight open protocol
l Used in (I)IoT in a constrained environment
l Low Bandwidth, High Latency
l Low Power Equipment
l Publish-Subscriber Model with Central Broker
Topics & Subscriptions
l Topics names form a hierarchical tree
l Messages published on a topic
l Subscriptions on a specific topic or with wildcards to a topic
sub-tree
l MQTT5: Shared Subscription
Brocker
Client 1
Client 2
Client 3
Messages
l Quality of Service – Message Delivery guarantees
l QoS 0: At most once
l QoS 1: At least once
l QoS 2: Exactly once
l Retained Messages
l LWT – Last Will Telegram
✉
→
m
y/t1
my/t1 → ✉
my/t2 ← ✉
✉
←
my/t1
✉
←
my/t2
https://mqtt.org
Sparkplug
MQTT + Sparkplug = 'Plug & Play' IIoT
16.05.23 13
l Specification originated by Cirrus Link Solutions now
maintained by the Eclipse Foundation
l Designed to allow interoperability between IIoT devices
l Allows realtime communication between devices in the
system
l Ensures devices and applications are aware of state and
configuration
Extends MQTT
l Defines a Topic Namespace
l Specifies Message payload content and serialization formats
l Sparkplug A: JSON
l Sparkplug B: Protobuf
l Defines device state management
l Broker failover
https://sparkplug.eclipse.org
Sparkplug
Architecture
16.05.23 14
Sparkplug
MQTT Topic Namespace
16.05.23 15
Message Format
l spAv1.0: JSON
l spBv1.0: Protobuf
namespace/group_id/message_type/edge_node_id/[device_id]
Type of Message
l NBIRTH: Sent by edge node when it gets online.
l NDEATH: Sent by broker (LWT) when an edge node goes
offline.
l DBIRTH, DDEATH: Similar to NBIRTH, NDEATH but sent by
edge node when a connected device gets online/offline
l NDATA: Sent by edge node when the state of the edge node
changes.
l DDATA: Sent by edge node when the state of a device
changes
l NCMD: Contains a command to an edge node
l DCMD: Contains a command to a device
Group ID allows dividing the
namespace into arbitrary
groups. E.g by region.
Unique identifier of an edge
node
Unique (within edge node)
identifier of a device
Sparkplug
Payload content
16.05.23 16
Payload Fields
l Timestamp
l Array of Metrics
l Name
l Data type
l Value
l Timestamp
l Optional:
l Alias
l Historical, Transient, Null
l Properties (property set)
l Quality Code,…
l Metadata (seq, filename, filetype md5sum, description
…)
l Optional
l UUID
l Body (byte data)
Connecting IoT with Kafka
16.05.23 17
MQTT Broker
Topics to which
Edge Nodes
publish
Topics to which
Edge Nodes
subscribe
Kafka
iot-mqtt-source
iot-mqtt-sink
MQTT Source Connector
Kafka Connect
MQTT Sink Connector
IoT Services
Connecting IoT with Kafka
MQTT Source Connector
16.05.23 18
l We use Confluent’s MQTT Source Connector
l Copy messages from topics written by Edge Nodes to
Kafka iot-mqtt-source topic
l /spBv1.0/+/NBIRTH/#
l /spBv1.0/+/DBIRTH/#
l /spBv1.0/+/NDEATH/#
l /spBv1.0/+/DDEATH/#
l /spBv1.0/+/NDATA/#
l /spBv1.0/+/DDATA/#
l Don’t use Clean Session, to not loose messages when
connector temporarely goes offline
l Kafka Message
l Key: MQTT Topic name to which payload was published
l Data: MQTT Raw message (Protobuf, Sparkplug b)
https://docs.confluent.io/kafka-connectors/mqtt/current/mqtt-source-connector
l What about the ordering of messages in Kafkas partitions?
Connecting IoT with Kafka
MQTT Source Connector – With Custom Partitioner
16.05.23 19
l We have a requirement that message ordering is guaranteed per Edge Node
l Default Partitioner is hashing message key to determine the partition
l Custom partitioner guarantee that all messages from one Edge Node are store in the same partition
namespace/group_id/message_type/edge_node_id/[device_id]
Partition number: #(full_key) MOD num_partition
namespace/group_id/message_type/edge_node_id/[device_id]
Partition number: #(edge_node_id) MOD num_partition
Custom SMT
16.05.23 20
No easy way to access the # partitions of
destination Kafka topic within an SMT
Better Solution - Custom Partitioner
16.05.23 21
In a partitioner we have access to the a Cluster
object, this gives us access to the # of partitions
Connecting IoT with Kafka
MQTT Sink Connector
16.05.23 22
l We use Confluent’s MQTT Sink Connector
l Source Topic: iot-mqtt-sink
l Kafka Message
l Key: MQTT Topic name to which message shall be
published
l Data: MQTT Raw message (Protobuf, Sparkplug b)
l By default the connector publishes into the MQTT topic
that has the same name as the Kafka topic.
l Change the behaviour by using ExtractTopic SMT
provided by Confluent, to publish to the correct MQTT
topic
https://docs.confluent.io/kafka-connectors/mqtt/current/mqtt-sink-connector/
Do’s & Don’t’s
16.05.23 23
l Select the right architecture depending on your needs. Fat vs
Thin Edge Devices. Pushing Kafka to the Edge may not make
sense.
l When working with Sparkplug, start with JSON, when the
system is more mature, switch to Protobuf
l Use good tools. For MQTT use MQTT Explorer, and build from
source to get Protobuf deserializer support.
l Write defensive code in SMTs/Partitioners
l Test your system, esp. for performance, and outages of
brokers and connectors.
l Don’t invent your own IoT protocol
l Don’t use SMTs to do the work of a partitioner
l Try avoiding using custom SMTs and/or partitioners if you
plan to use cloud hosted Kafka Connect
16.05.23 24
Questions
Thank You
©2023. ALL RIGHTS RESERVED.
Principal Engineer
l Email: yves.kurz@paul.tech
l Web: https://paul.tech/
l Twitter: @yveskurz
l Sources: https://github.com/yveskurz/kafka-summit-2023-
sparkplug-kafka
Yves Kurz

More Related Content

What's hot

How Pulsar Enables Netdata to Offer Unlimited Infrastructure Monitoring for F...
How Pulsar Enables Netdata to Offer Unlimited Infrastructure Monitoring for F...How Pulsar Enables Netdata to Offer Unlimited Infrastructure Monitoring for F...
How Pulsar Enables Netdata to Offer Unlimited Infrastructure Monitoring for F...
StreamNative
 

What's hot (20)

Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Envoy and Kafka
Envoy and KafkaEnvoy and Kafka
Envoy and Kafka
 
Kubernetes Monitoring & Best Practices
Kubernetes Monitoring & Best PracticesKubernetes Monitoring & Best Practices
Kubernetes Monitoring & Best Practices
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using Kafka
 
쿠버네티스의 이해 #1
쿠버네티스의 이해 #1쿠버네티스의 이해 #1
쿠버네티스의 이해 #1
 
Apache Kafka - Messaging System Overview
Apache Kafka - Messaging System OverviewApache Kafka - Messaging System Overview
Apache Kafka - Messaging System Overview
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Distributed Lock Manager
Distributed Lock ManagerDistributed Lock Manager
Distributed Lock Manager
 
Kafka 101 and Developer Best Practices
Kafka 101 and Developer Best PracticesKafka 101 and Developer Best Practices
Kafka 101 and Developer Best Practices
 
ksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database SystemksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database System
 
Introduction to Kafka Streams
Introduction to Kafka StreamsIntroduction to Kafka Streams
Introduction to Kafka Streams
 
Distributed tracing using open tracing & jaeger 2
Distributed tracing using open tracing & jaeger 2Distributed tracing using open tracing & jaeger 2
Distributed tracing using open tracing & jaeger 2
 
No data loss pipeline with apache kafka
No data loss pipeline with apache kafkaNo data loss pipeline with apache kafka
No data loss pipeline with apache kafka
 
A Deep Dive into Kafka Controller
A Deep Dive into Kafka ControllerA Deep Dive into Kafka Controller
A Deep Dive into Kafka Controller
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
How Pulsar Enables Netdata to Offer Unlimited Infrastructure Monitoring for F...
How Pulsar Enables Netdata to Offer Unlimited Infrastructure Monitoring for F...How Pulsar Enables Netdata to Offer Unlimited Infrastructure Monitoring for F...
How Pulsar Enables Netdata to Offer Unlimited Infrastructure Monitoring for F...
 
Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting Techniques
 
Kafka presentation
Kafka presentationKafka presentation
Kafka presentation
 
Apache Kafka Fundamentals for Architects, Admins and Developers
Apache Kafka Fundamentals for Architects, Admins and DevelopersApache Kafka Fundamentals for Architects, Admins and Developers
Apache Kafka Fundamentals for Architects, Admins and Developers
 

Similar to Integrating Sparkplug IoT Edge of Network Nodes with Kafka with Yves Kurz

Some important networking questions
Some important networking questionsSome important networking questions
Some important networking questions
Srikanth
 
TRADITIONAL V/S "MODERN / IIOT" SCADA: DEMAND RESPONSE V/S REPORT BY EXCEPTION
TRADITIONAL V/S "MODERN / IIOT" SCADA: DEMAND RESPONSE V/S REPORT BY EXCEPTIONTRADITIONAL V/S "MODERN / IIOT" SCADA: DEMAND RESPONSE V/S REPORT BY EXCEPTION
TRADITIONAL V/S "MODERN / IIOT" SCADA: DEMAND RESPONSE V/S REPORT BY EXCEPTION
iQHub
 
INTERNWT OF THINGS KHiuahjqilkjhJU HAUI JHJKQB HJAGE IUH OLJQHNORJ BQJ
INTERNWT OF THINGS KHiuahjqilkjhJU HAUI JHJKQB HJAGE IUH OLJQHNORJ BQJINTERNWT OF THINGS KHiuahjqilkjhJU HAUI JHJKQB HJAGE IUH OLJQHNORJ BQJ
INTERNWT OF THINGS KHiuahjqilkjhJU HAUI JHJKQB HJAGE IUH OLJQHNORJ BQJ
150ROHITCHANDRASHEKH
 

Similar to Integrating Sparkplug IoT Edge of Network Nodes with Kafka with Yves Kurz (20)

Message queuing telemetry transport (mqtt) launch
Message queuing telemetry transport (mqtt) launchMessage queuing telemetry transport (mqtt) launch
Message queuing telemetry transport (mqtt) launch
 
Message queuing telemetry transport (mqtt) launch
Message queuing telemetry transport (mqtt) launchMessage queuing telemetry transport (mqtt) launch
Message queuing telemetry transport (mqtt) launch
 
Powering your next IoT application with MQTT - JavaOne 2014 tutorial
Powering your next IoT application with MQTT - JavaOne 2014 tutorialPowering your next IoT application with MQTT - JavaOne 2014 tutorial
Powering your next IoT application with MQTT - JavaOne 2014 tutorial
 
Getting Started with Kafka on k8s
Getting Started with Kafka on k8sGetting Started with Kafka on k8s
Getting Started with Kafka on k8s
 
Mqtt 5 meetup dortmund
Mqtt 5 meetup dortmundMqtt 5 meetup dortmund
Mqtt 5 meetup dortmund
 
Some important networking questions
Some important networking questionsSome important networking questions
Some important networking questions
 
Arduino basics
Arduino basicsArduino basics
Arduino basics
 
Connecting Internet of Things to the Cloud with MQTT
Connecting Internet of Things to the Cloud with MQTTConnecting Internet of Things to the Cloud with MQTT
Connecting Internet of Things to the Cloud with MQTT
 
Building the Internet of Things with Eclipse IoT - IoTBE meetup
Building the Internet of Things with Eclipse IoT - IoTBE meetupBuilding the Internet of Things with Eclipse IoT - IoTBE meetup
Building the Internet of Things with Eclipse IoT - IoTBE meetup
 
MQTT enabling the smallest things
MQTT enabling the smallest thingsMQTT enabling the smallest things
MQTT enabling the smallest things
 
Networking essentials lect1
Networking essentials lect1Networking essentials lect1
Networking essentials lect1
 
TCP/IP 3RD SEM.2012 AUG.ASSIGNMENT
TCP/IP 3RD SEM.2012 AUG.ASSIGNMENTTCP/IP 3RD SEM.2012 AUG.ASSIGNMENT
TCP/IP 3RD SEM.2012 AUG.ASSIGNMENT
 
SDN: an introduction
SDN: an introductionSDN: an introduction
SDN: an introduction
 
Overlay/Underlay - Betting on Container Networking
Overlay/Underlay - Betting on Container NetworkingOverlay/Underlay - Betting on Container Networking
Overlay/Underlay - Betting on Container Networking
 
TRADITIONAL V/S "MODERN / IIOT" SCADA: DEMAND RESPONSE V/S REPORT BY EXCEPTION
TRADITIONAL V/S "MODERN / IIOT" SCADA: DEMAND RESPONSE V/S REPORT BY EXCEPTIONTRADITIONAL V/S "MODERN / IIOT" SCADA: DEMAND RESPONSE V/S REPORT BY EXCEPTION
TRADITIONAL V/S "MODERN / IIOT" SCADA: DEMAND RESPONSE V/S REPORT BY EXCEPTION
 
MQTT with .NET Core
MQTT with .NET CoreMQTT with .NET Core
MQTT with .NET Core
 
Introduction MQTT in English
Introduction MQTT in EnglishIntroduction MQTT in English
Introduction MQTT in English
 
Chapter 3. sensors in the network domain
Chapter 3. sensors in the network domainChapter 3. sensors in the network domain
Chapter 3. sensors in the network domain
 
Building a sdn solution for the deployment of web application stacks in docker
Building a sdn solution for the deployment of web application stacks in dockerBuilding a sdn solution for the deployment of web application stacks in docker
Building a sdn solution for the deployment of web application stacks in docker
 
INTERNWT OF THINGS KHiuahjqilkjhJU HAUI JHJKQB HJAGE IUH OLJQHNORJ BQJ
INTERNWT OF THINGS KHiuahjqilkjhJU HAUI JHJKQB HJAGE IUH OLJQHNORJ BQJINTERNWT OF THINGS KHiuahjqilkjhJU HAUI JHJKQB HJAGE IUH OLJQHNORJ BQJ
INTERNWT OF THINGS KHiuahjqilkjhJU HAUI JHJKQB HJAGE IUH OLJQHNORJ BQJ
 

More from HostedbyConfluent

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
HostedbyConfluent
 
Evolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at TrendyolEvolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at Trendyol
HostedbyConfluent
 

More from HostedbyConfluent (20)

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Renaming a Kafka Topic | Kafka Summit London
Renaming a Kafka Topic | Kafka Summit LondonRenaming a Kafka Topic | Kafka Summit London
Renaming a Kafka Topic | Kafka Summit London
 
Evolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at TrendyolEvolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at Trendyol
 
Ensuring Kafka Service Resilience: A Dive into Health-Checking Techniques
Ensuring Kafka Service Resilience: A Dive into Health-Checking TechniquesEnsuring Kafka Service Resilience: A Dive into Health-Checking Techniques
Ensuring Kafka Service Resilience: A Dive into Health-Checking Techniques
 
Exactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and KafkaExactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and Kafka
 
Fish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit LondonFish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit London
 
Tiered Storage 101 | Kafla Summit London
Tiered Storage 101 | Kafla Summit LondonTiered Storage 101 | Kafla Summit London
Tiered Storage 101 | Kafla Summit London
 
Building a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And WhyBuilding a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And Why
 
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
 
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
 
Navigating Private Network Connectivity Options for Kafka Clusters
Navigating Private Network Connectivity Options for Kafka ClustersNavigating Private Network Connectivity Options for Kafka Clusters
Navigating Private Network Connectivity Options for Kafka Clusters
 
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data PlatformApache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
 
Explaining How Real-Time GenAI Works in a Noisy Pub
Explaining How Real-Time GenAI Works in a Noisy PubExplaining How Real-Time GenAI Works in a Noisy Pub
Explaining How Real-Time GenAI Works in a Noisy Pub
 
TL;DR Kafka Metrics | Kafka Summit London
TL;DR Kafka Metrics | Kafka Summit LondonTL;DR Kafka Metrics | Kafka Summit London
TL;DR Kafka Metrics | Kafka Summit London
 
A Window Into Your Kafka Streams Tasks | KSL
A Window Into Your Kafka Streams Tasks | KSLA Window Into Your Kafka Streams Tasks | KSL
A Window Into Your Kafka Streams Tasks | KSL
 
Mastering Kafka Producer Configs: A Guide to Optimizing Performance
Mastering Kafka Producer Configs: A Guide to Optimizing PerformanceMastering Kafka Producer Configs: A Guide to Optimizing Performance
Mastering Kafka Producer Configs: A Guide to Optimizing Performance
 
Data Contracts Management: Schema Registry and Beyond
Data Contracts Management: Schema Registry and BeyondData Contracts Management: Schema Registry and Beyond
Data Contracts Management: Schema Registry and Beyond
 
Code-First Approach: Crafting Efficient Flink Apps
Code-First Approach: Crafting Efficient Flink AppsCode-First Approach: Crafting Efficient Flink Apps
Code-First Approach: Crafting Efficient Flink Apps
 
Debezium vs. the World: An Overview of the CDC Ecosystem
Debezium vs. the World: An Overview of the CDC EcosystemDebezium vs. the World: An Overview of the CDC Ecosystem
Debezium vs. the World: An Overview of the CDC Ecosystem
 
Beyond Tiered Storage: Serverless Kafka with No Local Disks
Beyond Tiered Storage: Serverless Kafka with No Local DisksBeyond Tiered Storage: Serverless Kafka with No Local Disks
Beyond Tiered Storage: Serverless Kafka with No Local Disks
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Integrating Sparkplug IoT Edge of Network Nodes with Kafka with Yves Kurz

  • 1. Integrating Sparkplug IoT EoN Nodes with Kafka - A Real-world Example Yves Kurz – PAUL Tech AG
  • 2. Outline 16.05.23 3 What does PAUL do? 3 IoT Architecture @ PAUL 9 MQTT Primer 12 Introduction to Sparkplug 13 Connecting IoT and Kafka 15 Do‘s and Don‘ts 24
  • 3. 4 In 2023 PAUL will save ~ 21‘500 Tons of CO₂! To compensate that amount of CO₂ it would need an area of 10’000 sqm of forest or… … ~80% the size of Airport Heathrow! … ~3x the size of Central Park! … ~4x the size of Disneyland California!
  • 4. What does PAUL do? PAUL implements the adaptive hydraulic balancing in drinking water systems and heating. 16.05.23 5
  • 5. PAUL Smart Valve PAUL Gateway PAUL Temperature Sensor PAUL Energy Valve What does PAUL do? PAUL implements the adaptive hydraulic balancing in drinking water systems and heating. 16.05.23 6
  • 6. The optimization through PAUL's AI and its advantages AI technology analyzes the current state of the entire system and optimizes it Consumption Behaviour Vacancy Weather Sun side orientation Day time / Season Combines billions of data points from other houses. PAUL AI ADVANTAGES Up to 40% energy savings! Optimization of ESG ratings! More attractive interest rates for refinancing! Sizing of new heating systems based on consumption data instead of assumptions! Perfect preparation for the use of alternative heat generators! 16.05.23 7
  • 7. PAUL Tech AG in Numbers 16.05.23 8 4 Offices: Mannheim, Nürnberg, Jacksonville, Bern >130 Employees 2017 Year of Establishment >150‘000 Residential Units >500‘000‘000 Data Points https://www.paul.tech/en/career
  • 8. PAUL’s Legacy Architecture 2017-2022 16.05.23 9 l Traditional Industrial Automation Architecture l Expensive l Does not scale l Hard to maintain Input Output PLC SCADA/Supervisory Reporting AWS Field Level
  • 9. New Architecture 2022- 16.05.23 10 AWS Field Level Control Center & Dashboarding Services Kafka IoT Services Kafka Connect MQTT Broker l Concept and architecture validation from Oct ‘21 – March’22 l Implementation May ’22- l In productive use since Dec ‘22 l No PLC and SCADA system l Router is Sparkplug EoN node l From Polling to Report by Exception
  • 10. Covered in this Session 16.05.23 11 AWS Field Level Control Center & Dashboarding Services Kafka IoT Services Kafka Connect MQTT Broker l MQTT - Transport Protocol between Edge Nodes l Sparkplug – MQTT Topic and Payload Definition l Kafka Connect – Bridging MQTT and Kafka
  • 11. MQTT Primer 16.05.23 12 l Message Queuing Telemetry Transport l Lightweight open protocol l Used in (I)IoT in a constrained environment l Low Bandwidth, High Latency l Low Power Equipment l Publish-Subscriber Model with Central Broker Topics & Subscriptions l Topics names form a hierarchical tree l Messages published on a topic l Subscriptions on a specific topic or with wildcards to a topic sub-tree l MQTT5: Shared Subscription Brocker Client 1 Client 2 Client 3 Messages l Quality of Service – Message Delivery guarantees l QoS 0: At most once l QoS 1: At least once l QoS 2: Exactly once l Retained Messages l LWT – Last Will Telegram ✉ → m y/t1 my/t1 → ✉ my/t2 ← ✉ ✉ ← my/t1 ✉ ← my/t2 https://mqtt.org
  • 12. Sparkplug MQTT + Sparkplug = 'Plug & Play' IIoT 16.05.23 13 l Specification originated by Cirrus Link Solutions now maintained by the Eclipse Foundation l Designed to allow interoperability between IIoT devices l Allows realtime communication between devices in the system l Ensures devices and applications are aware of state and configuration Extends MQTT l Defines a Topic Namespace l Specifies Message payload content and serialization formats l Sparkplug A: JSON l Sparkplug B: Protobuf l Defines device state management l Broker failover https://sparkplug.eclipse.org
  • 14. Sparkplug MQTT Topic Namespace 16.05.23 15 Message Format l spAv1.0: JSON l spBv1.0: Protobuf namespace/group_id/message_type/edge_node_id/[device_id] Type of Message l NBIRTH: Sent by edge node when it gets online. l NDEATH: Sent by broker (LWT) when an edge node goes offline. l DBIRTH, DDEATH: Similar to NBIRTH, NDEATH but sent by edge node when a connected device gets online/offline l NDATA: Sent by edge node when the state of the edge node changes. l DDATA: Sent by edge node when the state of a device changes l NCMD: Contains a command to an edge node l DCMD: Contains a command to a device Group ID allows dividing the namespace into arbitrary groups. E.g by region. Unique identifier of an edge node Unique (within edge node) identifier of a device
  • 15. Sparkplug Payload content 16.05.23 16 Payload Fields l Timestamp l Array of Metrics l Name l Data type l Value l Timestamp l Optional: l Alias l Historical, Transient, Null l Properties (property set) l Quality Code,… l Metadata (seq, filename, filetype md5sum, description …) l Optional l UUID l Body (byte data)
  • 16. Connecting IoT with Kafka 16.05.23 17 MQTT Broker Topics to which Edge Nodes publish Topics to which Edge Nodes subscribe Kafka iot-mqtt-source iot-mqtt-sink MQTT Source Connector Kafka Connect MQTT Sink Connector IoT Services
  • 17. Connecting IoT with Kafka MQTT Source Connector 16.05.23 18 l We use Confluent’s MQTT Source Connector l Copy messages from topics written by Edge Nodes to Kafka iot-mqtt-source topic l /spBv1.0/+/NBIRTH/# l /spBv1.0/+/DBIRTH/# l /spBv1.0/+/NDEATH/# l /spBv1.0/+/DDEATH/# l /spBv1.0/+/NDATA/# l /spBv1.0/+/DDATA/# l Don’t use Clean Session, to not loose messages when connector temporarely goes offline l Kafka Message l Key: MQTT Topic name to which payload was published l Data: MQTT Raw message (Protobuf, Sparkplug b) https://docs.confluent.io/kafka-connectors/mqtt/current/mqtt-source-connector l What about the ordering of messages in Kafkas partitions?
  • 18. Connecting IoT with Kafka MQTT Source Connector – With Custom Partitioner 16.05.23 19 l We have a requirement that message ordering is guaranteed per Edge Node l Default Partitioner is hashing message key to determine the partition l Custom partitioner guarantee that all messages from one Edge Node are store in the same partition namespace/group_id/message_type/edge_node_id/[device_id] Partition number: #(full_key) MOD num_partition namespace/group_id/message_type/edge_node_id/[device_id] Partition number: #(edge_node_id) MOD num_partition
  • 19. Custom SMT 16.05.23 20 No easy way to access the # partitions of destination Kafka topic within an SMT
  • 20. Better Solution - Custom Partitioner 16.05.23 21 In a partitioner we have access to the a Cluster object, this gives us access to the # of partitions
  • 21. Connecting IoT with Kafka MQTT Sink Connector 16.05.23 22 l We use Confluent’s MQTT Sink Connector l Source Topic: iot-mqtt-sink l Kafka Message l Key: MQTT Topic name to which message shall be published l Data: MQTT Raw message (Protobuf, Sparkplug b) l By default the connector publishes into the MQTT topic that has the same name as the Kafka topic. l Change the behaviour by using ExtractTopic SMT provided by Confluent, to publish to the correct MQTT topic https://docs.confluent.io/kafka-connectors/mqtt/current/mqtt-sink-connector/
  • 22. Do’s & Don’t’s 16.05.23 23 l Select the right architecture depending on your needs. Fat vs Thin Edge Devices. Pushing Kafka to the Edge may not make sense. l When working with Sparkplug, start with JSON, when the system is more mature, switch to Protobuf l Use good tools. For MQTT use MQTT Explorer, and build from source to get Protobuf deserializer support. l Write defensive code in SMTs/Partitioners l Test your system, esp. for performance, and outages of brokers and connectors. l Don’t invent your own IoT protocol l Don’t use SMTs to do the work of a partitioner l Try avoiding using custom SMTs and/or partitioners if you plan to use cloud hosted Kafka Connect
  • 24. Thank You ©2023. ALL RIGHTS RESERVED. Principal Engineer l Email: yves.kurz@paul.tech l Web: https://paul.tech/ l Twitter: @yveskurz l Sources: https://github.com/yveskurz/kafka-summit-2023- sparkplug-kafka Yves Kurz