SPL File ActiveReplicaLeader.spl

com.ibm.streamsx.plumbing > redundant 1.0.1 > com.ibm.streamsx.plumbing.sample.redundant.active > ActiveReplicaLeader.spl

Content

Operators

Composites

composite ActiveReplicasLeader

Active replica flow as a single job with leadership election.

Demonsrates use of LeadershipElection through LeadershipSwitchWithReplay with a path parameter to have leadership election across jobs.

SPL Source Code


 public composite ActiveReplicasLeader
 {
     graph
        stream<T> Alerts = SourceAnalyticsFlow() {}
 
        stream<T> AlertsLeader = LeadershipSwitchWithReplay(Alerts) {
          param
             group: "alerts_leader";
             path: "/streamsx.plumbing.across_jobs";
             period: 10.0;
        }
 
        () as SMS = SendSMS(AlertsLeader) { }
 
     // Single PE so any failure within a job causes a leadership
     // election to select another job as the leader.
     config placement: partitionColocation("singlePE");
 }