valueLane.get()
returns the current value of that valueLane()
@ajay-gov got it. what im trying to achieve is, to get the old and new value on the client side.
on the server side,
@SwimLane("info")
ValueLane<String> info = this.<String>valueLane()
.didSet((newValue, oldValue) -> {
logMessage("`info` set to " + newValue + " from " + oldValue);
});
this prints the old and new value every time i set a new value. like this, [/welcome/user]
infoset to hello from world
but on client side,
.didSet((newValue, oldValue) => {
console.log("link watched info change to " + newValue + " from " + oldValue);
})
this always comes as absent.
Maybe I'm understanding the purpose of value lane incorrectly?
@vishnuprasad73_twitter
const client = new swim.WarpClient();
let valueLane = client.downlinkValue()
.hostUri("warp://localhost:9001").nodeUri("/welcome/user").laneUri("info")
.didSet((newValue, oldValue) => {
console.log("link watched info change to " + newValue + " from " + oldValue);
})
.open();
is all you need. Whenever the "info" lane for the node "/welcome/user" gets updated on the server then the didSet
callback in the valueLane
reference in the client should get invoked with the oldValue
and the newValue
. Are you not seeing this?
@ajay-gov i tried that. but when i set a new value, the callback im getting on the client side is,link watched info change to john from Value.absent()
i have the same callback on server side, which works correctly.
@SwimLane("info")
ValueLane<String> info = this.<String>valueLane()
.didSet((newValue, oldValue) -> {
logMessage("`info` set to " + newValue + " from " + oldValue);
});
which logs out put as below,
[/welcome/user] `info` set to doe from john
valuelane.set(swim.Value.fromAny("john"))
still it shows as absent on client side though
client.close
the connection to the server is closed and all downlinks will stop getting the data from the server.
Hi @ajay-gov
I am a two day old swimer, so the workings of swim are not yet very clear to me. I'm exploring the possibility of using a webagent as single writer per stream in an eventstore.
How does one co-ordinate planes in such a manner that only one instance of a webagent can exist in a "cluster" of servers, and ensure that requests are routed/re-routed to the node that has that instance running? this would be kind of like what you can achieve with Akka Cluster Sharding. Is this possible with swim?