Integrate flunder into your app
Blueprint: Integrating with the FLECS Service Mesh using flunder
(C++)
flunder
(C++)Introduction
This documentation serves as a blueprint for developers looking to integrate their applications with the FLECS Service Mesh, a real-time communication layer powered by the open-source protocol Zenoh. The example provided demonstrates how to use the flunder
C++ client to set up a high-performance pub/sub communication pattern.
You can use this example as a starting point for developing your own low-latency, service-mesh-aware applications.
Goals of the Blueprint
Show how to initialize and configure a
flunder
client.Provide reusable callback mechanisms for processing messages.
Illustrate how to subscribe to and publish structured messages.
Highlight performance-related practices such as timestamp-based latency analysis.
Serve as a template for production-grade implementations using C++.
Key Features
β Real-time messaging using
flunder
over Zenohβ Strong typing and parsing logic for message payloads
β Timestamp-based performance metrics
β User-defined context (e.g., tagging) in callbacks
β Clean shutdown support
How to Use This Blueprint
1. Clone and Review the Example
2. Understand the Components
a. Client Initialization and Connection
Use this pattern to:
Instantiate a
flunder
clientConnect it to the mesh
Add optional in-memory storage (for local caching)
b. Subscribing to Topics
Topics follow a hierarchical format and support wildcards. The callback processes incoming messages by topic name.
If you need user context in your callbacks (e.g., tags, identifiers):
c. Publishing Data
Repeat as needed for different data types (e.g., double
, string
, timestamps).
d. Measuring Latency (Optional)
On the receiving side, subtract this timestamp from the current time to get one-way latency estimates.
Extend This Blueprint
You can build on this example to:
Subscribe to more topic patterns using semantic names (e.g.,
sensor/temperature
,status/health
)Add authentication or security layers
Swap in persistent storage instead of
add_mem_storage
Integrate with other systems (e.g., OPC UA, MQTT) via adapters
Performance Insights
Our internal benchmarks show latencies as low as 35β45Β΅s, depending on the transport and host system. This makes flunder
an ideal fit for industrial and time-sensitive workloads.
Getting Started
Build the Example
Run
Terminate with Ctrl+C
.
Next Steps
Use this example as a template, and start replacing topic names, data structures, and business logic with your own. If youβre building automation systems, digital twins, real-time analytics, or other data-driven applications, this blueprint is your launchpad into the FLECS ecosystem.
Last updated
Was this helpful?