Giter Site home page Giter Site logo

Comments (2)

abreits avatar abreits commented on July 17, 2024

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.

eXeDK avatar eXeDK commented on July 17, 2024

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)

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.