Dynamically Scriptable Distributed Components in Lua using DDS

At the RTI Labs we are excited about the Internet of Things (IoT).

We have been working on a new component model that makes it really easy to construct sophisticated distributed systems without needing to compile or generate a single line of code. Furthermore, the code can be changed on the fly, without having to restart components. The global state of a component is preserved between executions while its code can change, thus allowing for component behavior to change dynamically. The wiring of the components is specified in a separate configuration file. A container loads the configuration file, binds the communication resources to the logical I/O ports on the component, and runs the component code.

The component code is written in a scripting language called Lua. Lua is popular in the gaming community, and has recently been adopted by the Eclipse Machine-to-Machine (M2M) community. We chose Lua because it is easy to embed and extend in C, has a very small footprint, does not necessarily require an OS and is considered by some to be the fastest scripting language. Like JavaScript and Python, popular in web and DevOps communities, it is a dynamically typed language that is easy to learn, and brings the same benefits of agile and rapid development. Lua is mature and well thought out. It has been around longer than Java and JavaScript, and is simply fun to program in!

For example, a transformation of the data used in the RTI Shapes Demo application can simply be written in Lua as:

Shapes Demo in Lua

The above code takes input shapes from the data-space, changes their size, and writes them back to the data-space. We run this in a container that wires the input to the Square topic and output to the Triangle topic in the data-space used by the Shapes Demo. We can see the shape mediation happening in real-time:


Now, if we increase the SIZE_FACTOR from 0.5 to 5 in a text editor, we immediately see the updated output:

(Click to view full-size image)

We have built the component model to run in a variety of containers. We are publicly releasing an experimental container using the XML-Based application configuration and prototyping capability for defining the data types, QoS, and DDS endpoints. The container can be configured to run the component code upon any or all of the following events: startup, shutdown, data arrival or a periodic timer.

The result is a deeply data-centric architecture that decouples data from the code not just at the system level (using DDS) but also at the component level. The application architecture is easy to maintain and evolve for both large and small teams. It clearly separates the role of the component/algorithm developer responsible for business logic from the system integrator responsible for wiring the components and configuring quality of service (QoS) at the system level.

This new experimental component technology is available as a free download from the RTI Community Portal. Included in the bundle is a detailed getting started guide and several working examples showing correlation, splitting, aggregation, transformation, choreography, device I/O, data collection and data generation.

Give it a whirl — Go ahead and use it to build your next IoT app and let us know what you think!

NOTE: We are presenting at the OMG Component Workshop in Berlin today, June 17.

Getting Started with Connext

Connext® is the world's leading implementation of the Data Distribution Service (DDS) standard for Real-Time Systems. Try a fully-functional version of Connext for 30 days.

Free Trial