Replies: 7 comments 7 replies
-
@burakakca that article documents how to use Forms with the Java API. From javascript you can use the |
Beta Was this translation helpful? Give feedback.
-
@Tag("cube")
public class Cube {
@Member("int")
private int cubeSize = 1;
// @Member("string")
// private String cubeColor = "#000000";
// @Member("position")
// private Position cubePosition = new Position();
public Cube() {}
public Cube(int size) {
this.cubeSize = size;
}
// public Cube(int size, String color, Position position) {
// this.cubeSize = size;
// this.cubeColor = color;
// this.cubePosition = position;
// }
public int getCubeSize() {
return this.cubeSize;
}
// public String getCubeColor() {
// return this.cubeColor;
// }
// public Position getCubePosition() {
// return this.cubePosition;
// }
@Kind
private static Form<Cube> form;
public static Form<Cube> form() {
if (form == null) {
form = Form.forClass(Cube.class);
}
return form;
}
public Value toValue() {
return Form.forClass(Cube.class).mold(this).toValue();
}
@Override
public String toString() {
return Recon.toString(form().mold(this));
}
}
@SwimLane("setCube")
CommandLane<Cube> setCube = this.<Cube>commandLane()
.onCommand((Cube value) -> {
System.out.println("CubeValue: " + value);
}); const recordCube = Record.create(2).attr("cube").slot("cubeSize", context.cubeSize);
swim.command(Env.SWIM_URL, `/cube/${workflowId}/cubeSize`, 'setCube', recordCube); // or I tested with recordCube.toValue() Result: |
Beta Was this translation helpful? Give feedback.
-
@burakakca Sorry the documentation was incorrect earlier, we fixed this yesterday. The If you want this structure then you should have: Can you try this please? |
Beta Was this translation helpful? Give feedback.
-
@burakakca could you share your java code please? We have the same code that you are using and it seems to work for us. This is what we used based on what you sent:
Agent Code snippet:
JS Code (Assuming the agent is configured with the uri pattern /unit/:id in the server.recon file)
Output from the Agent: |
Beta Was this translation helpful? Give feedback.
-
https://github.com/burakakca/swim-example-error/blob/main/java/src/main/java/plantmonitor/agents/Cube.java#L8 Can you share the js code as well if that is the case? |
Beta Was this translation helpful? Give feedback.
-
In the
Main thing is that the |
Beta Was this translation helpful? Give feedback.
-
My code is like that there is one difference between them, I used node.js and you used on the browser. I'm looking into it
This is works Thanks. Also, how to convert the Cube class on the js to Recon |
Beta Was this translation helpful? Give feedback.
-
I read forms article and I have a custom type like fooType. I didn't figure out how to send that type of message with command.
Beta Was this translation helpful? Give feedback.
All reactions