Giter Site home page Giter Site logo

nsq.js's People

Contributors

achille-roussel avatar calvinfo avatar ekristen avatar fixe avatar gjohnson avatar jcrugzz avatar juliangruber avatar mafintosh avatar mreiferson avatar poying avatar ralphtheninja avatar rv-jhuston avatar sorribas avatar stephenmathieson avatar thehydroimpulse avatar tj avatar victorquinn avatar yields avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nsq.js's Issues

Priority / QOS

Is there any sense of priority queues ? Not sure from look at code of NSQ...

why close does not exit?

var nsq = require('nsq.js');

var writer = nsq.writer('10.10.133.80:4150');
writer.publish('urlitems', "www.sina.com.cn");
console.log("ok.");
writer.close();

when i run it, the command do not exit, why?

Run nsq.js on React.js

Shitty question,

Can I run this nsq client library with react.js? I use react with ES6 standard.
I already try but no luck.

Thanks.

reinvention of the wheel

Hey TJ -

You may have already seen https://github.com/brianc/node-nsqueue but wanted to point it out to you incase you didn't. It's actually written in JS, extremely well tested & been used by us heavily in production for about 50m messages so far. It's intended to be low level, handling none of the reconnection, back-off, dropping, or anything else logic. It's purpose is to facilitate writing higher level clients (with nsqlookup, reconnection, etc) on top. It contains a component similar to your lib/connection.js that basically maps 1-1 with the nsq binary protocol. It supports MPUB with optional callbacks for all the operations nsq will actually give you an ack for. The only thing I know which is currently missing is compression. Our messages are tiny so I didn't have a need for that yet.

I originally was going to use the coffee-script library, but had an issue with messages going "missing" and it was a bit easier for me to write a new client than to debug that one for a few reasons -- and I wanted something more 'low level.' I'm not looking to win any sort of award or popularity, I simply wrote it because I needed something working in production as soon as possible. I figure you were probably in a similar situation. If you see any way we could merge my work into this repo or platform this one on top of node-nsqueue - I'd be happy to collapse 2 modules into one / save the re-work rather than have yet another "900 modules that do the same thing, all of them missing 1 or 2 features." At the very least maybe you can find some parts reusable & save yourself some time.

Please lemme know whatcha think.

Cheers,
b

npm install nsq.js error


$ npm install nsq.js --save
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data

> [email protected] install E:\zan\coding\panli\curlnode\node_modules\nsq.js\node_modules\bignum
> node-gyp configure build


E:\zan\coding\panli\curlnode\node_modules\nsq.js\node_modules\bignum>if not defined npm_config_node_gyp (node "D:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure build )  else (node  configure build )
▒ڴ˽▒▒▒▒▒▒▒▒һ▒▒▒▒▒▒һ▒▒▒▒Ŀ▒▒▒▒Ҫ▒▒▒ò▒▒▒▒▒▒ɣ▒▒▒▒▒ӡ▒/m▒▒▒▒▒ء▒
  bignum.cc
..\bignum.cc(413): warning C4244: ▒▒=▒▒: ▒ӡ▒double▒▒ת▒▒▒▒▒▒uint64_t▒▒▒▒▒▒▒ܶ▒ʧ▒▒▒▒ [E:\zan\coding\panli\curlnode\node_modules\nsq.js\node_modules\bignum\build\bignum.vcxproj]
  win_delay_load_hook.c
LINK : fatal error LNK1181: ▒޷▒▒▒▒▒▒▒▒ļ▒▒▒C:\OpenSSL-Win64\lib\libeay32.lib▒▒ [E:\zan\coding\panli\curlnode\node_modules\nsq.js\node_modules\bignum\build\bignum.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "build"
gyp ERR! cwd E:\zan\coding\panli\curlnode\node_modules\nsq.js\node_modules\bignum
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "nsq.js" "--save"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp configure build'.
npm ERR! This is most likely a problem with the bignum package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls bignum
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     E:\zan\coding\panli\curlnode\npm-debug.log


writes and closes

Try to play nicer.

Error: invalid state
    at Connection.onframe (/usr/local/lib/node_modules/integration-worker/node_modules/nsq.js/lib/connection.js:226:17)
    at Framer.emit (events.js:95:17)
    at Framer.write (/usr/local/lib/node_modules/integration-worker/node_modules/nsq.js/lib/framer.js:56:10)
    at Socket.<anonymous> (/usr/local/lib/node_modules/integration-worker/node_modules/nsq.js/lib/connection.js:90:49)
    at Socket.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:764:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:426:10)
    at emitReadable (_stream_readable.js:422:5)
    at readableAddChunk (_stream_readable.js:165:9)
Error: write after end
    at writeAfterEnd (_stream_writable.js:132:12)
    at Socket.Writable.write (_stream_writable.js:180:5)
    at Socket.write (net.js:615:40)
    at Connection.command (/usr/local/lib/node_modules/integration-worker/node_modules/nsq.js/lib/connection.js:183:8)
    at Connection.finish (/usr/local/lib/node_modules/integration-worker/node_modules/nsq.js/lib/connection.js:349:8)
    at Message.finish (/usr/local/lib/node_modules/integration-worker/node_modules/nsq.js/lib/message.js:49:13)
    at /usr/local/lib/node_modules/integration-worker/lib/worker.js:178:34
    at Worker.process (/usr/local/lib/node_modules/integration-worker/lib/worker.js:88:14)
    at Worker.onmessage (/usr/local/lib/node_modules/integration-worker/lib/worker.js:175:18)
    at Reader.emit (events.js:106:17)

Reconnection to dead nsqd nodes

It's more a curiosity about how this happens, shouldn't the nsqd nodes reconnect once network is okay, since they heartbeat every X seconds the nsqlookupd hosts?
I would like to know if this is related to nsqio/nsq#851

proper nsqd termination

from what I've read nsqd does not send any "I'm doing down" message so we can't really disambiguate between graceful and ungraceful exits

increase throughput

more than enough for now but could use improvement, haven't profiled anything yet

tests are wonky

Sometimes the pass and sometimes the timeout/fail. It's defiantly an issue with just the tests as our apps run just fine but it would be nice to fix them :-)

tests ;D

little tricky to test without launching a ton of real instances, but still lots that can use unit tests

Deferred publish

Hi,
Any plan to add the deferred publish DPUB available from nsq 0.3.6 ?
Thank you

remove `msg.finish` callback?

got confused about why msg.finish() wasn't calling back, until I saw nsqio/nsq#320

any thoughts on removing it from the msg.finish signature? seems like you could still listen on error and handle that however you'd like

don't reconnect if identify fails

If you identify incorrectly, the nsqd server drops your connection. I think rather than reconnecting with the same bad values over and over, we should just bubble the error up.

14/09/05 10:22:05 CLIENT(192.168.1.3:59946): desired protocol magic '  V2'
2014/09/05 10:22:05 [192.168.1.3:59946] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:05 ERROR: [192.168.1.3:59946] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:05 PROTOCOL(V2): [192.168.1.3:59946] exiting ioloop
2014/09/05 10:22:05 PROTOCOL(V2): [192.168.1.3:59946] exiting messagePump
2014/09/05 10:22:05 TCP: new client(192.168.1.3:59947)
2014/09/05 10:22:05 CLIENT(192.168.1.3:59947): desired protocol magic '  V2'
2014/09/05 10:22:05 [192.168.1.3:59947] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:05 ERROR: [192.168.1.3:59947] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:05 PROTOCOL(V2): [192.168.1.3:59947] exiting ioloop
2014/09/05 10:22:05 PROTOCOL(V2): [192.168.1.3:59947] exiting messagePump
2014/09/05 10:22:06 TCP: new client(192.168.1.3:59948)
2014/09/05 10:22:06 CLIENT(192.168.1.3:59948): desired protocol magic '  V2'
2014/09/05 10:22:06 [192.168.1.3:59948] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:06 ERROR: [192.168.1.3:59948] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59948] exiting ioloop
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59948] exiting messagePump
2014/09/05 10:22:06 TCP: new client(192.168.1.3:59949)
2014/09/05 10:22:06 CLIENT(192.168.1.3:59949): desired protocol magic '  V2'
2014/09/05 10:22:06 [192.168.1.3:59949] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:06 ERROR: [192.168.1.3:59949] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59949] exiting ioloop
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59949] exiting messagePump
2014/09/05 10:22:06 TCP: new client(192.168.1.3:59950)
2014/09/05 10:22:06 CLIENT(192.168.1.3:59950): desired protocol magic '  V2'
2014/09/05 10:22:06 [192.168.1.3:59950] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:06 ERROR: [192.168.1.3:59950] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59950] exiting ioloop
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59950] exiting messagePump
2014/09/05 10:22:06 LOOKUPD(0.0.0.0:4160): sending heartbeat
2014/09/05 10:22:06 TCP: new client(192.168.1.3:59952)
2014/09/05 10:22:06 CLIENT(192.168.1.3:59952): desired protocol magic '  V2'
2014/09/05 10:22:06 [192.168.1.3:59952] IDENTIFY: {ShortId:Garretts-MacBook-Pro LongId:Garretts-MacBook-Pro.local ClientID:example Hostname: HeartbeatInterval:0 OutputBufferSize:0 OutputBufferTimeout:0 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:0 Snappy:false SampleRate:0 UserAgent:nsq.js/0.11.3 MsgTimeout:1800000}
2014/09/05 10:22:06 ERROR: [192.168.1.3:59952] - E_BAD_BODY IDENTIFY msg timeout (1800000) is invalid - msg timeout (1800000) is invalid
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59952] exiting ioloop
2014/09/05 10:22:06 PROTOCOL(V2): [192.168.1.3:59952] exiting messagePump
2014/09/05 10:22:21 LOOKUPD(0.0.0.0:4160): sending heartbeat
2014/09/05 10:22:36 LOOKUPD(0.0.0.0:4160): sending heartbeat

uncatchable error

Although I have an error listener in place, there's an unhandled error event. I'll investigate.

var nsq = require('nsq.js');

var r = nsq.reader({
  topic: 't',
  channel: 'c',
  nsqd: ['n']
});

r.on('error', function(err){
  console.error(err.stack);
});
 ∴  node t
Error: n:4150: getaddrinfo ENOTFOUND n n:4150
    at errnoException (dns.js:25:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:75:26)
events.js:141
      throw er; // Unhandled 'error' event
            ^
Error: n:4150: getaddrinfo ENOTFOUND n n:4150
    at errnoException (dns.js:25:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:75:26)
 ∴  echo $?
1

Pause/Resume is broken

Pause/Resume is just broken.

Tried node 4.4.5 and 6.4.0 with nsq.js@latest and with the version that the pause example first showed up in the library.

/cc @dweinstein

Memory leak caused by setInterval

It seems hardly to resolve this problem in normal way, but node-sleep + child_process may be an alternative solution.

// timer.js
var sleep = require('sleep').sleep;
while (1) {
  sleep(1);
  process.send('tick');
}

// reader.js
this.timer = child_process.fork('./timer');
this.timer.on('message', function (msg) {
  // poll
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.