Skip to content

Commit

Permalink
integration examples
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-higgins committed Apr 28, 2024
1 parent 244dfe5 commit cb7b3c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public static void main(String[] args) throws NoSuchFieldException, IllegalAcces

//LOOKUP AUDITOR BY NAME
MyAuditor myAuditor = processor.getAuditorById("myAuditor");
System.out.println("\nMyAuditor::invocationCount " + myAuditor.getInvocationCount());
//PULL DATA FROM AUDITOR
System.out.println("\nPULL MyAuditor::invocationCount " + myAuditor.getInvocationCount());
}

public static class MyAuditor implements Auditor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
package com.fluxtion.example.reference.integration;

import com.fluxtion.compiler.Fluxtion;
import com.fluxtion.compiler.builder.dataflow.DataFlow;
import com.fluxtion.runtime.annotations.OnEventHandler;
import com.fluxtion.runtime.node.NamedNode;

public class GetNodeByIdExample {
public static void main(String[] args) throws NoSuchFieldException {
var processor = Fluxtion.interpret(c ->{
DataFlow.subscribeToNode(new DirtyStateNode())
.console("Monday is triggered");
});
var processor = Fluxtion.interpret(new MondayChecker());
processor.init();

processor.onEvent("Monday");
processor.onEvent("Tuesday");
processor.onEvent("Wednesday");

DirtyStateNode dirtyStateNode = processor.getNodeById("MondayChecker");
System.out.println("Monday count:" + dirtyStateNode.getMondayCount() + "\n");
//LOOKUP USER NODE
MondayChecker mondayChecker = processor.getNodeById("MondayChecker");

//PULL DATA
System.out.println("PULLING Monday count:" + mondayChecker.getMondayCount());

processor.onEvent("Monday");
System.out.println("Monday count:" + dirtyStateNode.getMondayCount());
//PULL DATA
System.out.println("PULLING Monday count:" + mondayChecker.getMondayCount());
}

public static class DirtyStateNode implements NamedNode {

public static class MondayChecker implements NamedNode {
private int mondayCounter = 0;

@OnEventHandler
Expand Down

0 comments on commit cb7b3c6

Please sign in to comment.