Comments (2)
While it is true that the amqplib Connection class extends EventEmitter, the amqp-ts Connection does not, because it is not based on the amqplib Connection, it uses the amqplib Connection internally and exposes some elements of it when a successful connection has been made.
see: https://github.com/abreits/amqp-ts/blob/master/lib/amqp-ts.d.ts
It is possible to use the internal, not in amqp-ts.d.ts exposed reference to the amqplib (Connection._connection) to get access to the event emitter of the amqplib Connection.
see: https://github.com/abreits/amqp-ts/blob/master/src/amqp-ts.ts#L44
To redesign the amqp-ts Connection to extend EventEmitter (and also emit/ propagate amqplib Connection events) is possible, but I do not believe it is the quick fix you think it is. I think it needs to be designed as follows:
- extend Connection class form EventEmitter
- after a connection has been established forward all (relevant, subscribed, ...) amqplib Connection events to the amqp-ts event emitter
- make sure everything keeps functioning after a connection loss and reconnect
I will put it on the backlog, but since other projects have priority now it could take a while to get implemented. However you are welcome to create a pull request. (I am still learning how to best deal with pull requests so please have some patience)
Best regards,
Ab
from amqp-ts.
Thanks you for the quick and thorough answer Ab, I'll have a look at the internal _connection you mentioned. If that's not sufficient I'll look into a fix.
Have a great day
Thomas
from amqp-ts.
Related Issues (20)
- Not able to find these modules HOT 2
- Implicit any type, fails strict TS HOT 1
- Minor queue.rpc documentation issue HOT 2
- Unhandled rejection TypeError: message.sendTo is not a function HOT 2
- Namespace 'winston' has no exported member 'LoggerInstance'. HOT 2
- IllegalOperationError: Channel closed HOT 2
- Using amqp-ts for angular 8.0.0 throws error HOT 5
- RPC: how can I send multiples messages to some queue (error reply consumer already set)
- Queue.onMessage RPC promise returned error: mapper_parsing_exception module=amqp-ts
- How to apply the timeout mechanism in RPC.
- Exchange.rpc function doesn't work correctly.
- Channel for each queue and exchange
- Close connection
- message.ack() takes 40+ milliseconds to actually ack HOT 5
- when network is bad ,then reconnection ,and the RPC don't work HOT 1
- Change Message.getContent() return to "unknown" type
- Upgrade to latest amqlib version
- missing @types/amqplib and @types/bluebird
- Unable to Connect RabbitMq from Browser using amqp-ts HOT 2
- IllegalOperationError: Channel closed
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 amqp-ts.