Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    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
    vinodparam
    @vinodparam

    Hi Friends,

    Is there any sample code for pulling data from a SQL database. I know the ingress cookbook does allow for non-WARP protocols but it doesn't explain how to get it from database. Will it work if I change the below to use the DB connection instead?
    final DataSourcePopulator pop = new DataSourcePopulator("tcp://mqtt.eclipseprojects.io:1883");

    Thanks.

    brohitbrose
    @brohitbrose

    Great question @vinodparam . No matter your exact case, you'll need to make a query using a JDBC driver, parse the results of that query, and then relay that information (either via commands or downlinks, most likely commands) to Web Agents within a Swim server.

    If the data is a one-time fetch, or something that periodically must be fetched without caring for the state within Web Agents, then it's safe to trivially do this in either the main thread, using standard JDBC drivers.

    If you instead wish that the data be fetched fetched directly by Web Agents during the server's runtime (this is a fairly typical use case; for example, you may want a VehicleAgent to query a database as soon as it comes alive), then you'll have to be a little bit more careful. JDBC calls are blocking tasks, and therefore the query portion of the aforementioned query-parse-relay logic should avoid being executed in the same thread pool as the "regular" Web Agent logic. In Swim, we accomplish this by offloading the task to asyncStage(), and the http-ingress-bridges cookbook has an example of this: https://www.swimos.org/tutorials/http-ingress-bridges/

    vinodparam
    @vinodparam
    Thanks @brohitbrose
    AvianshKumar
    @AvianshKumar

    Hi All,
    Can any one help me, how to fetch data from RDBMS DB and show in UI

    Any Sample project link?

    brohitbrose
    @brohitbrose
    Swim’s UI libraries do not care how the data is received, only that it exists within the lanes of Web Agents. So the flow will be:
    1. In Java, fetch the data using standard JDBC drivers, using asyncStage() as necessary (see my precious message in this channel), and relay that data (likely with Swim commands) to your custom Web Agents
    2. In JavaScript, downlink to the lanes that you care about. The callback functions to the downlinks will populate the data in your view.
    @AvianshKumar ^
    vinodparam
    @vinodparam
    @brohitbrose As I mentioned in my earlier comment, I am trying to fetch data from the database at regular intervals and try to push it to a Google Maps view. I wanted to review the approach that I am trying. I couldn't find a straightforward way to do this. So what I have done is tried to combine the HTTP Ingress bridges logic into the PlantMonitor example and replace the Webservices call with a db connection. But one of the challenges I am facing is that the rest of the sensor values are picked up from Javascript file sim.js. If I want a sensor which pulls from the DB, do I write the logic in a new Agent file like the FreeForexAPI and then publish to a Value Lane?
    Thanks
    brohitbrose
    @brohitbrose
    @vinodparam that is certainly a good way to start. As a first pass you can simply create more agents with the different functionalities as you suggested, publishing to lanes as you see fit. After you get this working, it’s trivial to consolidate them: either via mixin-style inheritance using traits, or hard coded into a single web agent (which enables shared memory optimizations but may bloat the code within the file).
    vinodparam
    @vinodparam

    Hi SwimOS Team,
    Thanks for all your earlier suggestions. I was able to get the data from database and load the webagents.
    The next part is plotting this on an UI. Here's one simple JS downlink I am trying to access:

    var counter = 0;
    const valueLink = swim.downlinkMap()
    .hostUri("warp://127.0.0.1:9001")
    .nodeUri("/fetchAll/vinod/sites/:siteid")
    .laneUri("allSites")
    .didUpdate((key, value) => {
    counter++;
    console.log(counter + " -> " +key + " --> " + value);
    }).open();

    1. The JoinValueLane "allSites" has the necessary details of all the sites identified by keys /fetchAll/vinod/sites/1, /fetchAll/vinod/sites/2, etc.
    2. I tried setting the key on the JoinValueLane as /fetchAll/vinod/sites/ for all the entries assuming that I can listen to /fetchAll/vinod/sites/ but that didn't work out.
    3. If I use the nodeUri /fetchAll/vinod/sites/1, /fetchAll/vinod/sites/2 then it works fine but I cannot check for each individual siteids from UI.

    I am trying to get all the sites for vinod. I feel like I am missing something here.
    Any help would be appreciated.
    Thanks.

    brohitbrose
    @brohitbrose
    @vinodparam I think the downlink has the wrong nodeUri. Note that it has a colon in it, which is inherently a bit suspicious
    vinodparam
    @vinodparam

    @brohitbrose Doesn't the colon represent dynamic components?

    This is my uri definition.
    @SwimRoute("/fetchAll/:userid/sites/:siteid")
    private AgentRoute<FetchAllData> idfetchUserSites;

    I am able to access the data from /fetchAll/vinod/sites/1 , /fetchAll/vinod/sites/2 but I am looking for a way to access all entries in the JoinValueLane allSites, that's what I am trying with the colon.

    brohitbrose
    @brohitbrose
    @vinodparam the recommended approach is to have a dedicated Web Agent of some type addressable under the URI /fetchAll/vinod. This will have a JoinValueLane, perhaps called “sites”. When your existing Web Agents come alive, they let the /fetchAll/vinod agent know, and the joinvaluelane opens the appropriate downlinks to those agents. You can then downlinkMap to nodeUri /fetchAll/vinod.
    downlinkMap to the joinvaluelane*
    Emir Kaan
    @emir.kaan:matrix.org
    [m]
    hi everyone, does swimjs client work on webworkers / shared webworkers?
    running in webworkers, is a good way to reach more performant for data streaming?
    Emir Kaan
    @emir.kaan:matrix.org
    [m]
    swimjs already use webworkers, ok!
    Emir Kaan
    @emir.kaan:matrix.org
    [m]
    swim-rust could work on webassembly?