Code that writes code (creating kdb+ q and Java from XML and XSD)

Following on from Meta-Programming == code that writes code (creating Java code from XML and XSD) where we discussed the use of meta-programming, code that writes code...
[Originally due to be entitled "MQTT 5.0 analytics platform, greenfield project build, part five"]
All code referenced here is available on GitHub at AlignmentSystems/CodeGen
In the last post we discussed the value of using Apache Velocity to turn an object model representation in XML (with an XSD) into a Java class definition file.
This is incredibly useful for any firm that is using any kind of message based infrastructure, whether that's FIXP-SBE-SOFH, FIX tag=value, ITCH/OUCH, MQTT, REST/JSON/WS or anything else.

Why?

Consider that a complete implementation of FIX, using the repository as a base involves hundreds of messages. If these messages are transmitted around multiple internal systems then there is a considerable overhead in simply maintaining the class definitions in each language. Consider a C++ trading platform that integrates with a Java VaR system, a Python market risk system and a legacy C settlement system. 
Through the use of CodeGen the risk of system changes can be reduced. The ecosystem can become more agile and the cost of changes and upgrades reduced.


Simply put, if you have a big complex Front-Office technology stack which is a pain to manage then we should talk! Email enquire (at) alignment-systems.com and we can help you to simplify and improve KPIs for connectivity.


Take the example for today

An MQTT sensor that creates a set of coordinates in three dimensions (x , y , z) and tags that with a UUID. A UUID is simply a 128-bit integer, so it can be represented as two 64 bit integers, a most-significant and least significant.

Above is the ExampleSensor.xml schema that describes the SensorObservation.


Below is the Java class constructor that is created:
public SensorObservation(Long uUIDmsb , Long uUIDlsb , Long x , Long y , Long z){
this.UUIDmsb = uUIDmsb ,
this.UUIDlsb = uUIDlsb ,
this.x = x ,
this.y = y ,
this.z = z
}


And the kdb+ table definition created:



And below the Java class created:

















See also

MQTT 5.0 analytics platform, greenfield project build, part one
MQTT 5.0 analytics platform, greenfield project build, part two
Why I love Apache Velocity
Meta-Programming == code that writes code (creating Java code from XML and XSD)
https://github.com/AlignmentSystems/CodeGen

Comments