Is it possible to create a mobile agent that uses Node.js? - node.js

My aim is to create a mobile agent written in Node.js that will perform data collection on each node that is part of the mobile agent platform. If any anomalous events are detected then this is reported back to the control server. The mobile agent will follow a predefined path, saving its state and transferring to another nodes once its task is complete. Are there any frameworks or existing projects that would be suitable for this?
The Java Aglet project is similar to my needs however is obviously only available for Java.

As there was no current solution/package, I have created and now maintain the mobile-agent-platform NPM package.
"A JavaScript Mobile Agent Platform that allows an agent to migrate across a network. A Supervisor node dispatches the Agent which can then autonomously move between Worker nodes, carrying/transferring its state and methods to the new node."
Note: the stack and program counter cannot be transferred due to limitations within Node.js.

Related

How ConfigCat webhooks would work in application running behind load balancer?

There are 4 instances of an application running behind a load balancer. How the ConfigCat webhook would work in this case? Do we need to configure 4 public URL's for all 4 servers in webhook settings?
Could you share some details about your use case? What would you like to achieve with webhooks? What kind of SDK are you using? What is the polling mode?
If you want to refresh the SDK's cache on Feature Flag value changes, you should consider using a distributed cache implementation (e.g. redis). Example custom cache in Java: https://configcat.com/docs/sdk-reference/java#custom-cache
If you implement a custom distributed cache, you'll only need to add your load balancer's url to the webhook because refreshing the cache in one instance will refresh the cache in the distributed cache so all of your instances could work with the latest configurations.
If you want to get notified about changes in each applications, there are different possibilities:
You can configure 4 public urls and use the webhooks just like you mentioned it.
If you are using auto polling mode, you can skip the webhooks part and start using the SDK's built-in configuration changed callbacks. e.g. in java: configurationChangeListener part at https://configcat.com/docs/sdk-reference/java#auto-polling-default. When the auto poll mode's polling happens the SDK detects if the configuration changed and it fires this event.
If you could share more details I could help you more.
Disclaimer: I am one of the founders of ConfigCat.

What is the production deployment / runtime architecture of ResolveJS backend systems?

Does the reSolveJS generally run as a single NodeJS application on the server for production deployment?
Of course, event store and read models may be separate applications (e.g. databases) but are the CQRS read-side and write-side handled in the same NodeJS application?
If so, can / could these be split to enable them to scale separately, given the premise of CQRS is that the read-side is usually much more active than the write-side?
The reSolve Cloud Platform may alleviate these concerns, given the use of Lambdas that can scale naturally. Perhaps this is the recommended production deployment option?
That is, develop and test as monolith (single NodeJS application) and deploy in production to reSolve Cloud Platform to allow scaling?
Thanks again for developing and sharing an innovative platform.
Cheers,
Ashley.
reSolve app can be scaled as any other NodeJS app, using containers or any other scaling mechanisms.
So several instances can work with the same event store, and it is possible to configure several instances to work with the same read database, or for every instance to have its own read database.
reSolve config logic is specified in the app's run.js code, so you can extend it to have different configurations for different instance types.
Or you can have the same code in all instances and just route command and queries to the different instance pools.
Of course, reSolve Cloud frees you from these worries, in this case you use local reSolve as dev and test environment, and deploy there.
Please note that reSolve Cloud is not yet publicly released. Also, local reSolve can not have all required database adapters at the moment, so those yet to be written.

Azure IoT Edge - How to diagnose locally while offline?

We are trying to create a simple local UI (standalone desktop app running on the Windows 10 Edge box) for displaying the overall health and diagnostics metrics on our IoT Edge device. The UI must be viewable if/when the device has no connection to the internet (offline). We want to show a list of modules, their status, last connection time, etc. All of this info is available in the Module Twins, but I don't see any way to access the module twins locally, while offline. Is there no local/shadow copy of these twins, or any api to query each module for its reported properties?
We are particularly interested in the edgeHub and edgeAgent modules, as they contain info about all the other modules, but I don't see any API to query those modules, other than the shell commands, iotedge list, iotedge logs edgeAgent, etc.
The only solution seems to be to programatically execute those shell commands and scrape the resulting output from the StandardOutput. Seems like there should be a better way.
If I wanted to access the module twins outside of the IoT Edge process and whilst offline, I would probably mount a volume to the module and save my reported properties in a JSON file. That way your local UI can access the files on the host machine. Of course, that does mean the module's twins are now in a readable unencrypted state on your host machine.
A more complex scenario would be to expose an HTTP endpoint on each module to access the last known values. You would need to specify a port to open on each module for this to work. You can open a port in the deployment json:
"createOptions": {
"ExposedPorts": {
"80/tcp": {}
}
}
Also, consider leveraging the new built-in metrics from system modules coming in the 1.0.10 release. Here is a lab that will help you set this up end-to-end using release candidate bits:
https://labs.iotedge.dev/codelabs/monitor-iotedge

How to code a Node.js Server to support multi-server horizontal scaling

does anyone have experience in using node.js server in a Cloud computing environment like Google Compute Engine/AWS that allows auto-scaling?
Is there any things to watch out for in your code if provider clones your node.js server across servers(Horizontal scaling)?
As long as your Node.js server is stateless, you can create a instance template of your server and use Google Autoscalar to automatically add or remove instances from a managed instance group based on increases or decreases in load. I recommend watching this video.

NodeJS packages to handle parallel headless tests on linux box(es) with selenium grid like features?

I need to handle authenticated multiple users running parallel tests on the selenium standalone server, and discovered two webdriver clients on nodejs. There's webdriver-js and wd-js. Which is more active and reliable? Any experiences? I'm a bit concerned about them breaking down when node or selenium updates or removes features.
I don't think any of those packages mention automatically starting Xvfb on a unique display number per test. So start shell commands to run xvfb before driving the browser?
The following process is what I am trying to build in nodejs (it's essentially like Grid 2 but on nodejs purpose of continuous integration of tests running) and looking for any packages or suggestions for any of the following part.
First authenticate the user(s) using a persistent bi-directional connection (WebSockets or HTTP 1.1)
Start/queue tests requested to run by the user on available hardware nodes (I will add more linux boxes so need a package to distribute parallel tests across the "grid")
Monitor the running selenium browser tests and send client status updates (ex) running/stop)
Tests submitted by the users need to be persistent and accessible for future or continuous integration (couchdb or mysql)
Scheduling of jobs to be run on a continuous basis (ex. run every set interval of time).
Is nodejs a bit overkill? should I focus on Java only for the backside?
https://github.com/LearnBoost/soda
This is for vanilla Sauce Labs/Selenium RC integration. I'd imagine when you're running in a browser instance like Selenium RC, websockets should just work, as the javascript on the page is executed. If you're authenticating a user, you want to just fill out whatever form and submit (which triggers your WS auth) as normal.
I don't think nodejs is overkill for this. Node is lightweight. I don't know that I'd add node to my stack ONLY for this, but its certainly convenient and if you have a commitment to javascript, its no big deal.

Resources