bunny icon indicating copy to clipboard operation
bunny copied to clipboard

Next Generation

Open jakubkulhan opened this issue 5 years ago • 1 comments

This pull request introduces backwards-incompatible changes that should become the next generation of this library, version 1.0.

It should solve some (long-standing) issues:

  • Automatic reconnect in case of connection failures. => Client instance won't be tied to a single connection. Instead it will present a simpler interface that can tolerate reconnections.
  • Problems with heartbeats. => Most of the problems reported by users of the library were due to heartbeat timeouts. The library should provide in such cases helpful exception messages.

As well as some design issues:

  • Mocking - So far, the library tied everything to concrete classes that couldn't be mocked easily. Now, client/connection/channel will extend interfaces that can be easily mocked.
  • Channels - Most applications, I've worked on, that needed to publish a message, do not really care about AMQP's channel multiplexing. New client interface takes care of this use case.
  • Sync consumers - In the begging the library was created mostly because there was no AMQP lib for ReactPHP. Sync API was an afterthought. However, most consumers, I'd created, used sync client. New concept of a subscription - iterable instance that waits for messages consumed from multiple queues, - seems like a better fit.
  • Duplicated sync/async logic - New version will internally use coroutines for the protocol logic. Sync/async connections will be just executors for these coroutines. It should avoid duplication of the connection code and a lot of checks whether the returned value is a promise, or an actual value found now in the library code.

TODO:

  • [ ] Sync interfaces
  • [ ] AMQP implemented using coroutines
  • [ ] Sync executor
  • [ ] Async (promise-based) interfaces
  • [ ] Async executor
  • [ ] Proper channel/connection error handling (see #80)
  • [ ] Connection factory can use multiple addresses (see #81)

jakubkulhan avatar Jan 06 '19 13:01 jakubkulhan

@jakubkulhan hello!

Are you been thinking about the reconnection strategy? How do you handle this in production environments?

Thanks!

mmoreram avatar Aug 13 '19 07:08 mmoreram