Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    brohitbrose
    @brohitbrose
    @kumarsen26 ^
    kumarsen26
    @kumarsen26

    @brohitbrose
    Please find server code.. I hope this helps..

    Plane:

    @SwimRoute("/customer")
      private AgentRoute<Customer> customer;

    Lane:

    @SwimLane("details")
        MapLane<String, Customer> view = this.<String, Customer>mapLane().didUpdate((key, newValue, oldValue) -> {
            System.out.println("the new value is " + newValue.toString());
        });
    brohitbrose
    @brohitbrose
    @kumarsen26 and what happens when you replace your Client code with:
    didUpdate((key,value) => {
        console.log(value.tail());
    });
    kumarsen26
    @kumarsen26

    @brohitbrose I am getting values as attached in the screenshot.

    image.png

    brohitbrose
    @brohitbrose

    good, the lower and upper bounds to the Record are correct. Let's now try:

    didUpdate((key,value) => {
        let customerDetails = value.tail();
        let contactInfoDetails = value.get("contactInfo");
    });

    Can you log these values using your method of choice and show the results?

    @kumarsen26 if you need the final result to be in a specific JSON format, it would be best to have a separate function to return a new object containing the final result. You should be able to build this object from customerDetails and contactInfoDetails (this might take a little more processing, maybe something like contactInfoDetails.getItem(0).tail() for the first value since it's an Array)as defined above
    NITESH
    @NITESHMEHTA68_twitter
    i want to learn swin from basic
    and want to become contributor
    any one help me
    Dobromir Marinov
    @DobromirM
    @NITESHMEHTA68_twitter You can get familiar with the core Swim concepts here: https://www.swimos.org/concepts/ and check the tutorials: https://www.swimos.org/tutorials/ to get started.
    Rikki
    @Yukaira
    Hey, i was reading the readme on swimos LED matrix driver and i saw that you could both run the server and client on the Pi, how would that work?
    kumarsen26
    @kumarsen26
    Hi Team,
    I am trying to access my swim-server using wss://localhost:9001 (secure websocket). Is it supported? if so do I need to do some configuration at server side? Kindly let me know if any example which i can refer
    brohitbrose
    @brohitbrose
    @Yukaira any device, including a Pi, that can concurrently run multiple processes will be able to run the server and client at once
    @kumarsen26 doing so requires setting up the server in a specific way that includes, among other things, certs on the machine and a Swim configuration that points to those certs. If you have certs ready, then we can walk you through how to do that
    brohitbrose
    @brohitbrose
    @kumarsen26 note that no additional configurations are needed if you configure the server without wss, i.e. use ws://localhost:9001
    kumarsen26
    @kumarsen26
    @brohitbrose Thank you .. Ok I will check and get back once I get the certificate..
    Thee, Meepeek
    @meepeek
    I'm new here. I read the web and have some questions
    1. How to scale out ? Can I run a dynamic cluster ?
    2. how to backup and administrate ? can I store a file as well ?
    3. Can I just run the Java server then use a nodejs server to handle logic ? or I need to program everything in Java for the server ?
    4. How the cache and security works ? should let the client contact swim server directly or through proxy ?
    5. How about authorize and access control ?
    Ajay.Gov
    @ajay-gov

    @meepeek Good questions.

    1. You can run swim in a cluster. Please look at this example of the transit application in a 2 node cluster: https://github.com/swimos/transit#run-as-a-fabric
    2. All swim lanes can be persisted if you turn the persistence option on. This is part of our enterprise offering. If you turn the persistence option on, then the data stored in the lanes for all agents of a specific type will get written into files on disk which you could then back up.
    3. Ideally it's best to program all the server side logic in java using the SwimOS platform
    4. The client can connect to the swim server directly. Web agents expose endpoints and streaming APIs, so data from the lanes will get streamed to your client
    5. You can configure access control and authorization programmatically. This typically done by injecting an Authenticator and a Policy to the Swim Plane. Here is an example from the cellular app: https://github.com/swimos/swim-cellular/blob/master/src/main/java/swim/cellular/CellularPlane.java#L24-L30

    Please do let us know if you have any other questions. Also one question for you, how did you hear about the Swim platform?

    Thee, Meepeek
    @meepeek
    I searched for something like web socket or web server communication. I forgot how i end up there but just yesterday as i lookup for easier way to deal with rpc or graphql. Swim concept is quite hit what i want, if it was nodejs, i'm sure i'll dig the code.
    @ajay-gov
    Thee, Meepeek
    @meepeek
    @ajay-gov as for the 2nd answer, does that mean without enterprise feature, the test server will run in memory only and the data will reset every time it restart ?
    Ajay.Gov
    @ajay-gov
    @meepeek yes that is correct. You could write through the data you want from the Web Agent to a database or a message broker. Here is an example of how to write to a database from a Web Agent: https://github.com/swimos/cookbook/tree/master/egress_bridges
    theseus yang
    @theseusyang
    What is highest performance network transport message volumes per computing node , who test it?
    theseus yang
    @theseusyang
    @ajay-gov Can you help me to answer this question?
    mesut
    @eniacce
    Hi everyone,I started as a newbie on swimos
    How can I use the maven on project structure?Would you please help me
    Ajay.Gov
    @ajay-gov
    Hi @eniacce we use gradle as our build tool. You would like to use maven, is that right?
    oznfc
    @oznfc
    hi , is clustering possible for swimos ?
    Ajay.Gov
    @ajay-gov
    @oznfc Yes you can cluster a swim application whereby you will be able to distribute web agents across multiple nodes which belong to the same cluster. The nodes themselves can be in the same machine or different machine. Here is documentation on how to run a two node cluster on the same machine on different ports- https://github.com/swimos/transit#run-as-a-fabric
    oznfc
    @oznfc
    ı tried it in plant-monitor example. ı think ı must configuration for ports. ı added server-a.recon and server-b.recon but when ı tried to run they getting port already using . ı'm trying run on 9009 port but it getting 9002 already used error.
    oznfc
    @oznfc
    ı solved this problem but ı have a question:
    When I close port 9009 (server a), data does not come to server-b. Even if I close one of them, I want the other to continue to do its job. Is it possible? If possible how?
    Ajay.Gov
    @ajay-gov
    @oznfc yes that is possible. How are you sending data to server-b when server a is down? Are you still server-a's url? The best way to do this is to set up a load-balancer which routes data to server-a or server-b when both are up but the load-balancer should send data to server-b only when server-a is down. You can do this with AWS DNS setup
    oznfc
    @oznfc
    oznfc
    @oznfc
    transit example worked with this setting
    server-b.recon
    image.png
    and its server-a.recon
    image.png
    oznfc
    @oznfc
    now I'm triying for plant-monitor example(https://github.com/swimos/plant-monitor) . ı started it by server-a.recon and server-b.recon . When I shut down the server that I started with server-a, the plants in server-b are also deleted and I cannot add them again.
    image.png
    oznfc
    @oznfc
    does swim using grapgh ? ı cant see any example but saw this doc.
    image.png
    oznfc
    @oznfc
    at this address : https://www.slideshare.net/nats_io/nats-connect-live-swimos-nats .
    does any example with nats.io ?
    ı asked a lot question . Thanks :)
    oznfc
    @oznfc
    can rust examples compile to wasm ?
    and can it work ?
    Ajay.Gov
    @ajay-gov
    @oznfc thanks for your detailed explanation on what you are trying to do regarding the clustering. I misunderstood your earlier question. So the swim clustering setup places agents in different nodes based on the configuration in the recon files. Swim applications are stateful and hence these web agents need to be pinned to just one node in the cluster. Now if you would like for the agents to migrate to another node in the cluster when one node goes down then you need an additional setup in the recon file. Specifically the recon file should designate a host with the "primary:false" propert/value. This will get all agents in nodeB to be replicated in nodeA (and vice-versa) which will enable nodeA to serve all requests even if nodeB goes down.
    Here is the relevant portion of server-a.recon with this replication setup:
    @mesh {
        @part {
            key: partA
            predicate: @hash(0x00000000, 0x7fffffff)
            @host {
                #uri: "warp://localhost:9008"
                primary: true
            }
            @host {
              uri: "warp://localhost:9009"
              primary: false
            }
        }
        @part {
            key: partB
            predicate: @hash(0x80000000, 0xffffffff)
            @host {
              #uri: "warp://localhost:9008"
              primary: false
            }
            @host {
                uri: "warp://localhost:9009"
                primary: true
            }
        }
    }
    And here is the relevant portion of server-b.recon with this replication setup:
    @mesh {
        @part {
            key: partA
            predicate: @hash(0x00000000, 0x7fffffff)
            @host {
                uri: "warp://localhost:9008"
                primary: true
            }
            @host {
              #uri: "warp://localhost:9009"
              primary: false
            }
        }
        @part {
            key: partB
            predicate: @hash(0x80000000, 0xffffffff)
            @host {
              uri: "warp://localhost:9008"
              primary: false
            }
            @host {
                #uri: "warp://localhost:9009"
                primary: true
            }
        }
    }
    Ajay.Gov
    @ajay-gov
    @oznfc Regarding your question on nats.io- Are you using nats for messaging on an external server? If so you can use the nats java client (https://github.com/nats-io/nats.java) within the swim application. When the nats client receives a message you may then forward the message to the appropriate web-agent.
    @oznfc Regarding your question on graphs-We have a UI framework that goes with our backend platform. The UI framework is purpose built to enable real-time web UI applications. This includes an extensive set of real-time widgets like: time-series charts, pie charts, gauges etc. You can try it out with our tutorial example: https://github.com/swimos/tutorial
    Purple Systems
    @purplesystems_twitter
    Hello friends