Getting Started

In this chapter, we will build a simple Pronghorn app. The goals are the following:

  1. Create a schema that defines passing of a "Hello World, $NAME" message.

  2. Write a stage that produces the input, and another stage that receives it and displays it.

  3. Get familiarized with Pronghorn basics and syntax.

We can then visualize our data flow:

(Of course, any real application would be a lot more complex than this simple example).

Before we do anything else, we need to actually create the message format, but before this, let's set up an actual Pronghorn project.

Creating a new Project

As instructed on the previous page, you need Maven installed. We use Maven Archetypes to generate a template for you to get started.

First, create a directory called PronghornProjects:

$ mkdir PronghornProjects
$ cd PronghornProjects

Next, run the following command:

$ mvn archetype:generate -DarchetypeGroupId=com.ociweb -DarchetypeArtifactId=pronghorn-ranch -DarchetypeVersion=1.0.5

You will then be prompted to fill out some information:

Define value for property 'groupID': com.ociweb
Define value for property 'artifactId': HelloWorldPronghorn
Define value for property 'version' 0.0.1-SNAPSHOT: (leave this blank) :
Define value for property 'package' com.ociweb: (leave this blank) :
Define value for property 'mainClass' : HelloWorldPronghorn

Hit "Y" to generate the HelloWorldPronghorn project.

Next, open the project in your favorite IDE. You can safely delete the following files (which will not be used in this simple tutorial):

  • SchemaOneSchema.java

  • SchemaTest.java

  • SchemaOne.xml

  • HelloWorldPronghornTest.java

Delete all the content in HelloWorldPronghorn.java and replace it with the following:

package com.ociweb;

import com.ociweb.pronghorn.pipe.Pipe;
import com.ociweb.pronghorn.stage.scheduling.GraphManager;
import com.ociweb.pronghorn.stage.scheduling.StageScheduler;

public class HelloWorldPronghorn  {
   public static void main(String[] args) {

        //todo: code here

   }
}

In the next chapters, we will edit this file to create our HelloWorld example.

Last updated