I just start to study JMS (Java Message Service). My first question is: when the point is "concurrency", is there some similarity between JMS' and Node.js' "purpose"?
Can I use Node.js for a "messaging system"?
I could search for lost samples, but i pre开发者_如何学编程fer to learn from someone's experience. Could you - that already used both technologies - help me?
I have never used JMS before, but from reading the wikipedia page, it seems like the main purpose is to have two or more java instances talk to each other. For example, you have 10 machines, each running a consuming application that takes a large files, and tries to find patterns in then, and one machine producing large files for the 10 other machines.
The main purpose of Node.JS is a much more local use, for example, when you read a file, instead of waiting for the answer, and not be able to do anything else, you can simply define a callback function to when the whole file is read.
The interesting ability of NodeJS is that it uses some kernel features that "warns" NodeJS that a certain file description has more information to be read. For example, if you want to read 10 files at the same time in Java, you could create 10 different threads and read each file individually, and that can become very slow. In NodeJS would open the 10 files, and the kernel would just tell it that more information is available. Read more at Scalable networking.
精彩评论