Comments (8)
In this case, the added procedures don't exist elsewhere, and if they did exist, would do exactly the same thing (one should hope). But I take your point, monkey patching does often lead to trouble.
from amqplib.
Definitely.
I would recommend a path similar to node-mysql
. This has the added benefit that you don't lose precision for full 64-bit integers and gives developers the output they need. If they really want to deal with half-integer arithmetic, they can convert from bignumber
to native numbers.
from amqplib.
Also related, it looks like you're depending on util._extend
in connect.js
. I absolutely agree that Node's util library should provide an extend
function, but given that it's a private function you might want to avoid that for now. It unnecessarily restricts the version of Node on which amqp.node can run and is essentially using a function that may disappear.
from amqplib.
Also related, it looks like you're depending on util._extend in connect.js.
I had a look around, and indeed it does appear that require('util')
as a whole is considered off-limits to third-party modules (though perhaps inherit
is forgivable).
I've replaced the use of _extend
with an artisanal clone function.
from amqplib.
I had a look around, and indeed it does appear that require('util') as a whole is considered off-limits to third-party modules (though perhaps inherit is forgivable).
That's probably because the util
module does not provide much beyond inherits
that would be useful for developers, apart from _extend
. The module itself is safe for any developer to use, provided they stick to the public API.
from amqplib.
In master the dependency has been updated to buffer-more-ints v0.0.2, which doesn't monkey-patch Buffer
(unless you tell it to, which I don't).
Still thinking about bignumber.js support. Not sure I like optionality of that kind (and it's not really optional, since the internals also use 64-bit integers in at least one place, message content size).
from amqplib.
In master the dependency has been updated to buffer-more-ints v0.0.2, which doesn't monkey-patch Buffer (unless you tell it to, which I don't).
Perfect. That means this issue is technically closed.
Still thinking about bignumber.js support. Not sure I like optionality of that kind (and it's not really optional, since the internals also use 64-bit integers in at least one place, message content size).
If message content size is the only place, it seems like bignumber.js support could still be optional, as long as the user is correctly informed that without said support the maximum message content size will be slightly limited. I cannot imagine any real-world message being that large--a message queue isn't a data storage device--but if it's useful, the user could enable it.
Not sure I like optionality of that kind.
That's fine.
You could return strings representing really large integers--have that a configurable option or something. Just a thought.
from amqplib.
If message content size is the only place, it seems like bignumber.js support could still be optional, as long as the user is correctly informed that without said support the maximum message content size will be slightly limited. I cannot imagine any real-world message being that large--a message queue isn't a data storage device--but if it's useful, the user could enable it.
And presently, you can only send a buffer, which can't be that big anyway.
Bignumbers would be useful for timestamps and "general purpose" 64-bit integers; that is, values that aren't used in the protocol but may be encoded in user-supplied data. It seems sensible to support them -- it's switching support on and off that I'm not keen on.
from amqplib.
Related Issues (20)
- Fanout delivery acknowledgement on channel 1 timed out HOT 6
- Set a custom header before nack-ing a message HOT 5
- No Error emitted when Queue disappears or is deleted HOT 2
- SDK connecting without errors after RabbitMQ service is shut down HOT 9
- Error emitted before handler is attached causes "Unhandled 'error' event" HOT 3
- consume does not respect promises? HOT 5
- Trailing dot in URL causes TLS failure HOT 2
- docs: channel api github page has broken top links HOT 2
- docs: confusing and inconsistent usage of terms "bork", "splode", "close" HOT 7
- global prefetch become 0 if per-consume prefetch set HOT 2
- ERR_SSL_EMS_NOT_ENABLED HOT 6
- How to determine if channel.ack() is successful? HOT 2
- CPU intensive controller prevents AMQP connection from receiving heartbeat, hence connections gets closed. HOT 2
- How to know if message is published ? HOT 6
- Aborting a Message Processing when RMQ Channel Closes HOT 8
- I'm encountering an "Unexpected close" error HOT 2
- Module not found: Can't resolve 'querystring' HOT 2
- Feature: Add support for AMQP 0.9.1 "update-secret" HOT 11
- 501 (FRAME-ERROR) - after indeterminate amount of large messages HOT 6
- Emits a acknowledge event. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amqplib.