This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
org.gramar.storm.gramar:walkthrough [2016/08/12 17:58] chrisgerken |
org.gramar.storm.gramar:walkthrough [2016/08/13 11:41] chrisgerken |
||
---|---|---|---|
Line 2: | Line 2: | ||
This page walks through a sample usage of the org.gramar.storm.gramar **gramar**. The specifics of the topology to be implemented aren't all that important. Instead we'll focus on how to use the gramar to generate almost all of the topology implementation. | This page walks through a sample usage of the org.gramar.storm.gramar **gramar**. The specifics of the topology to be implemented aren't all that important. Instead we'll focus on how to use the gramar to generate almost all of the topology implementation. | ||
+ | |||
+ | ==== Setup ==== | ||
+ | |||
+ | This walkthrough was run on a new Ubuntu VMware image with some additional installed software: | ||
+ | |||
+ | * Eclipse was downloaded and unzipped | ||
+ | * From Eclipse, **Help --> Install New Software** to install | ||
+ | * M2E from update site http://download.eclipse.org/releases/mars | ||
+ | * If this were a real development effort I'd probably also install EGit from here, too. | ||
+ | * Grammar from update site http://gramar.org/eclipse/gramar | ||
+ | * All gramars from update site http://gramar.org/eclipse/gramars | ||
+ | * In **Window --> Preferences --> Java --> Installed JRE's --> Execution Environment** select the installed JDK o be used for Java 1.8 | ||
+ | * From a terminal, use sudo apt-get to install the **graphviz** package. Technically it's not required, but you need graphviz to produce the topology diagrams and the diagrams will be a key success factor in a real project. | ||
+ | * For a real project, I'd also install git and maven | ||
==== The Model ==== | ==== The Model ==== | ||
Line 354: | Line 368: | ||
</code> | </code> | ||
+ | |||
+ | ==== Evolving the Topology ==== | ||
+ | |||
+ | When you write a Storm topology it will evolve. You'll find yourself adding, removing, merging or splitting spouts and bolts. The streams will change, too. You'll add and remove streams, change their source or destination and change their fields and their formats. Whenever you need to evolve your topology, you can simply update the original model to which you applied the gramar and apply the gramar again. | ||
+ | |||
+ | As long as you keep your code changes between the begin/end comment pairs you can make most of the above changes easily while keeping your business logic in place. There are some special cases where you do have to be careful: | ||
+ | |||
+ | * If you change the name of a stream, a new method will be generated in the receiving bolt's helper class. Be sure to save the previous read method on the side so you can copy the logic after the gramar re-apply. | ||
+ | * If you change the name (label) of a bolt or spout, a new set of classes will be generated according to the new name, but the classes for the previous label/name will still remain. You have to hand copy the cope you want to keep. |