Notas

Notas are Pronghorns alternative to Java annotations. We chose this approach because it avoids reflection while still providing readability. Notas allow you to “tag” your stage to modify their behavior or appearance. Please note that notas can have unexpected side effects and should be applied carefully.

Notas are always defined in the constructor of your stage. They should not be defined in startup() or any other place in your class.

Some common nota definitions are listed here:

Name

Description

Example

SCHEDULE_RATE

Specify the delay between calls regardless of how long call takes in nanoseconds.

GraphManager.addDefaultNota(gm, GraphManager.SCHEDULE_RATE, 500);

MONITOR

Used to tag internal stages. Do not use.

PRODUCER

Tag your stage as a producer. Usually, producing stages are automatically detected, but use this nota if the producer is expecting a response from another stage.

GraphManager.addNota(gm, GraphManager.PRODUCER, GraphManager.PRODUCER, this);

STAGE_NAME

Give a custom name to a stage.

GraphManager.addNota(graphManager, GraphManager.STAGE_NAME, "CustomStageName", this);

SLA_LATENCY

Define a custom Service Level Agreement in milliseconds. If your stage takes longer than this, a warning will appear.

GraphManager.addNota(graphManager, GraphManager.SLA_LATENCY, 100_000_000, this);

LOAD_BALANCER

Even splits traffic across outputs for your stage.

GraphManager.addNota(graphManager, GraphManager.LOAD_BALANCER, GraphManager.LOAD_BALANCER, this);

LOAD_MERGE

Consume equal priority traffic from inputs for your stage.

GraphManager.addNota(graphManager, GraphManager.LOAD_MERGE, GraphManager.LOAD_MERGE, this);

HEAVY_COMPUTE

Tag your stage as "Heavy compute". The scheduler will avoid putting any stages tagged with this onto the same thread.

GraphManager.addNota(graphManager, GraphManager.HEAVY_COMPUTE, GraphManager.HEAVY_COMPUTE, this);

TRIGGER

Limit rate or flow and triggers other stages.

ROUTER_HUB

Tag your stage as a potential bottleneck for traffic.

ISOLATE

Isolate your stage from its neighbors and put it on its own thread.

GraphManager.addNota(graphManager, GraphManager.ISOLATE, GraphManager.ISOLATE, this);

DOT_RANK_NAME

Stages with the same name as defined here will be put next to each other on the graph.

GraphManager.addNota(gm, GraphManager.DOT_RANK_NAME, "SocketReader", socketReaderStage);

DOT_BACKGROUND

Define a custom stage background color for telemetry.

GraphManager.addNota(graphManager, GraphManager.DOT_BACKGROUND, "lavenderblush", this);

UNSCHEDULED

Will not execute run() on this stage, only startup() and shutdown().

GraphManager.addNota(graphManager, GraphManager.UNSCHEDULED, GraphManager.UNSCHEDULED, this);

THREAD_GROUP

Used to tag internal stages and track behavior. Do not use.

Example

A stage constructor with a custom background color in the telemetry can look like this:

public BMPDumperStage(GraphManager graphManager, Pipe<JPGSchema> input, boolean verbose, boolean time) {
	super(graphManager, input, NONE);	
	this.input = input;​	// Use GraphManager to add a background nota to the current stage. "this" refers to the current stage.	
	GraphManager.addNota(graphManager, GraphManager.DOT_BACKGROUND, "red", this);
}

Last updated