node-red-contrib-mp-function 1.1.0

Multi-threaded function node for NODE-RED

npm install node-red-contrib-mp-function

Install


$ npm i node-red-contrib-mp-function

Or globally alongside Node-RED:


sudo npm i -g node-red-contrib-mp-function

You will need to restart Node-RED for it to pick-up the new nodes.

Changes in 1.1.0

new Added persistent option. When OFF new threads are created when new message arrives and are terminated when work is complete (thread limit and message caching also works). When ON, threads are waiting for messages as usual. new Command line for worker thread now contains name of the node. So you can kill it with fire, if anything happens.

Changes in 1.0.5

new Change from round-robin message distribution to load-balanced. When all threads are loaded incoming messages are queued. When thread calculation is finished, node will check inner message queue for new tasks. fix Fix vm context failure on creation of new script setup.

Usage

node-red-contrib-mp-function is based on original IBM function node. You need to see it basic usage at first. This node allows you to run your hardcore calculation code in separate process (or some of them) without freezing of node-red process and your other precious flows.

Customization

As you can import some external npm modules from node-red configuration? you can provide them into this node in 'Requires' field. The string must contain a name prefered for usage in your code and module name (or path to it) connected by an '<-' and joined by colon. For example:

canvas<-canvas,mylovelymodule<-/path/to/mylovelymodule.js,gzip<-zlib

The imported modules are accessible via context.global.yourmodulename for compatibility with original module

Limitations

You can not use context, flow or global variables... yet. Write necessary info to the msg var before passing it into node. Event handlers on node variable also do not work. And probably wont.

But you can print messages with node.log, node.warn and node.error. And you can use statuses as well.

License

MIT License

Node Info

Version: 1.1.0
Updated 4 days ago
License: MIT

Downloads

7 in the last day
77 in the last week
118 in the last month

Nodes

  • mp-function

Keywords

  • node-red

Maintainers

  • maxboar