wcharczuk / nsqnet Goto Github PK
View Code? Open in Web Editor NEWNSQ.net is a .net client for bit.ly's NSQ distributed queue system.
License: MIT License
NSQ.net is a .net client for bit.ly's NSQ distributed queue system.
License: MIT License
Hi,
I've noticed under high load RecieveMessage() does not always read the entire message from the network stream (probably in cases where the stream is not ready to be read)
You should be able to overcome this by changing
var size = BitConverter.ToInt32(sizebuffer, 0);
if (size != 0)
{
byte[] buffer = new Byte[size];
_networkStream.Read(buffer, 0, (int)size);
return UnpackMessage(size, buffer);
}
to:
var size = BitConverter.ToInt32(sizebuffer, 0);
if (size != 0)
{
byte[] buffer = new Byte[size];
var read = 0;
while (read < size) {
var readCount = _networkStream.Read(buffer, read, (int)size-read);
if (readCount < 0)
continue;
if (readCount == 0)
break;
read += readCount;
}
return UnpackMessage(size, buffer);
}
I'm working on some changes that I plan to submit a pull request for, which will add support for a number of new NSQ protocol options as well as negotiation for TLS/Deflate/Snappy support, and have a couple questions.
Thanks,
Levi
The calls to WriteAscii followed by WriteBinary appear to be intended to be part of an atomic operation, but are each locked independently. Therefore, the WriteAscii/WriteBinary calls of a pair of concurrent Publish invocations might be interleaved.
https://github.com/politician/NSQnet/blob/master/NSQnet/NSQProtocol.cs#L225-L226
I found in the NSQ client list that the client does not support the TLS protocol, which is very important in some environments at present. Can you extend the support?
Hi,
Is there a way to tell which topic a message came from when subscribing to multiple topics?
Thanks.
In NSQSubscriber.OnMessageReceived, the event handler NSQMessageReceived
is read twice outside of a lock, once in the if statement and once in the invocation.
https://github.com/politician/NSQnet/blob/master/NSQnet/NSQSubscriber.cs#L160-L161
Instead, that should be:
var handler = this.NSQMessageReceived;
if (handler != null) {
handler(this, e);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.