Defining Schemas
Pronghorn enforces data consistency for stage communication by using a fork of the XML based FAST Protocol. Unit tests (that every Schema requires) act as a contract between the Java Schema and the FAST file to ensure correctness.
Adding your own Schema
Pronghorn allows you to generate schema code based on an XML file. This saves time and allows rapid prototyping. Use the following list as a general guideline to get started on adding your own schemas.
1. Realize what the data looks like
Concern yourself with data flow first. For example, draw out the data flow on a whiteboard - enumerate what type of messages go down the pipes and what fields they need.
2. Define your XML schema as demonstrated in the Example Schema below
We utilize the FAST Protocol to define our messages. Create a new XML file in the test/resources
folder of your new PronghornRanch project, formatted as SchemaNAME.xml
. Edit the Example Schema to get started, using grouping, descriptive field names, and appropriate types as enumerated in Step 1.
Note: There is a known issue regarding shorts in the parser (they do not get generated). For now, use integers instead.
Example Schema
3. Create a basic unit test
You do not have to manually generate the schema java file. Once your test runs, it will fail but output the required Java file in the console that you then paste into your SchemaNAME.java
located in main/java/SchemaNAME.java
. Make sure to paste the entire output it provides you (this includes examples on how to actually use your generated schemas). See the example below or generate a PronghornRanch project.
Example Schema Test
4. Use your Schema
Your schema is now ready for use. You can now define pipes using your schema. See Building Custom Stages.
Supported Types
Last updated