Sets the priority of the edge. A lower number means higher priority
and the default is 0.
Example: there two incoming edges on a vertex, with priorities 1 and 2.
The data from the edge with priority 1 will be processed in full before
accepting any data from the edge with priority 2.
Possible deadlock
If you split the output of one source vertex and later join the streams
with different priorities, you're very likely to run into a deadlock. Consider this DAG:
S --+---- V1 ----+--- J
\ /
+-- V2 --+
The vertex
J joins the streams, that were originally split from
source
S. Let's say the input from
V1 has higher
priority than the input from
V2. In this case, no item from
V2 will be processed by
J before
V1 completes,
which presupposes that
S also completes. But
S cannot
complete, because it can't emit all items to
V2 because
V2 is blocked by
J, which is not processing its items. This is
a deadlock.
This DAG can work only if
S emits as few items into both paths
as can fit into the queues (see
EdgeConfig#setQueueSize.
Note
Having different priority edges will cause postponing of
the first snapshot until after upstream vertices of higher priority
edges are completed.
Reason: after receiving a
com.hazelcast.jet.impl.execution.SnapshotBarrier we stop
processing items on that edge until the barrier is received from all
other edges. However, we also don't process lower priority edges until
higher priority edges are done, which prevents receiving the barrier on
them, which in the end stalls the job indefinitely. Technically this
applies only to
com.hazelcast.jet.config.ProcessingGuarantee#EXACTLY_ONCEsnapshot mode, but the snapshot is also postponed for
com.hazelcast.jet.config.ProcessingGuarantee#AT_LEAST_ONCE jobs, because the snapshot won't complete until after all
higher priority edges are completed and will increase the number of
duplicately processed items.