We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If a Join Map Lane is created with a didUpdate callback and another one is added in the didStart method of the agent, the first one is duplicated.
didUpdate
didStart
Example:
BasicPlane.java
public class BasicPlane extends AbstractPlane { @SwimRoute("/unit/:id") AgentRoute<UnitAgent> unitAgentType; public static void main(String[] args) { final Kernel kernel = ServerLoader.loadServer(); final ActorSpace space = (ActorSpace) kernel.getSpace("basic"); kernel.start(); System.out.println("Running Basic server..."); kernel.run(); space.command("/unit/foo", "wakeup", Value.absent()); } }
UnitAgent.java
public class UnitAgent extends AbstractAgent { @SwimLane("shoppingCart") MapLane<String, Integer> shoppingCart = this.<String, Integer>mapLane(); @SwimLane("addItem") CommandLane<String> publish = this.<String>commandLane() .onCommand(msg -> { final int n = this.shoppingCart.getOrDefault(msg, 0) + 1; this.shoppingCart.put(msg, n); }); @SwimLane("join") JoinMapLane<String, String, Integer> stateStreetStats = this.<String, String, Integer>joinMapLane().didUpdate((key, newValue, oldValue) -> { System.out.println("join map lane: " + key + " count changed to " + newValue + " from " + oldValue); }); @Override public void didStart() { stateStreetStats.downlink("foo").hostUri("warp://127.0.0.1:9001").nodeUri("/unit/foo").laneUri("shoppingCart").open() .didUpdate((key, newValue, oldValue) -> { System.out.println("join map lane agent didStart: " + key + " count changed to " + newValue + " from " + oldValue); }); } }
Input
@command(node:"/unit/foo", lane:"addItem")"foo"
Output
join map lane: foo count changed to 1 from 1 join map lane agent didStart: foo count changed to 1 from 0 join map lane: foo count changed to 1 from 1
(The last line should not be present)
The text was updated successfully, but these errors were encountered:
The problem does NOT happen if the second downlink and didUpadate method are created using the plane context.
didUpadate
Sorry, something went wrong.
No branches or pull requests
If a Join Map Lane is created with a
didUpdate
callback and another one is added in thedidStart
method of the agent, the first one is duplicated.Example:
BasicPlane.java
UnitAgent.java
Input
Output
(The last line should not be present)
The text was updated successfully, but these errors were encountered: