bus icon indicating copy to clipboard operation
bus copied to clipboard

feat(transport): add mqtt

Open MaximeMRF opened this issue 1 year ago • 1 comments

Hello 👋🏻 ,

I have a few questions concerning my PR:

  • Currently mqtt tests are run only on the hivemq broker because it's the broker included in the testcontainers package. I'm wondering if it's useful to run tests on other mqtt brokers like EMQX ?

  • Concerning the onReconnect method I can't have the same behavior as Redis, the mqtt client handle automatic reconnexion

MaximeMRF avatar May 25 '24 08:05 MaximeMRF

Currently mqtt tests are run only on the hivemq broker because it's the broker included in the testcontainers package. I'm wondering if it's useful to run tests on other mqtt brokers like EMQX ?

I'm really not familiar with MQTT. What are the most commonly used brokers? It would be cool to include test for those

Also, please update the documentation in the README

Julien-R44 avatar May 25 '24 08:05 Julien-R44

Hello @Julien-R44, sorry i've not work on this pr since a long time but now i'm back i will update the readme once you will say me that's the code is legit to a merge

MaximeMRF avatar Sep 01 '24 17:09 MaximeMRF

The tests seem to pass.

I do have one question, though. RabbitMQ is a broker that supports acknowledgments, right? So, doesn’t the worker need to acknowledge the job before it’s removed from the bus?

RomainLanz avatar Sep 02 '24 07:09 RomainLanz

I don't know very well RabbitMQ (I have never use it) but yeah it support acknowledgments like mqtt brokers.

Yes good suggestion, I have forgot that but I can add the QoS option to the MqttTransportConfig to support the acknowledgments. So all messages sended by the producer will have the same quality of service.

MaximeMRF avatar Sep 02 '24 13:09 MaximeMRF

This bus package is designed as a fire-and-forget broker, so we're intentionally avoiding any acknowledgment logic.

The question is: can we use RabbitMQ without acknowledgments, or will the message remain in the bus until it's acknowledged by a consumer?

RomainLanz avatar Sep 02 '24 13:09 RomainLanz

Ah ok my bad. Yes it seems to, but my pr is here to support the mqtt protocol as well as mqtt broker but not amqp and broker like RabbitMQ and Kafka. And by default mqtt has no acknowledgments so it fit your requirements

MaximeMRF avatar Sep 02 '24 15:09 MaximeMRF

Is this PR ready @MaximeMRF? Looks all good to me 👍

Any additional comments @RomainLanz, or can we merge this?

Julien-R44 avatar Oct 01 '24 21:10 Julien-R44

@Julien-R44 hi before merge i have to provide the docs

MaximeMRF avatar Oct 01 '24 22:10 MaximeMRF

All questions are answered on my side!

Do you plan to use it in your project @MaximeMRF?

RomainLanz avatar Oct 02 '24 06:10 RomainLanz

Hi @RomainLanz,

Not atm but it can be a interesting alternative to Redis depending of the project.

For example, I have a IOT project and I use a mqtt broker to transport datas from my sensors to a backend and if in the future, I want to use the bus package I can simply dedicate some topics of my broker for that instead of deploying a redis instance.

MaximeMRF avatar Oct 02 '24 08:10 MaximeMRF

Thanks a lot for the PR!

Julien-R44 avatar Oct 02 '24 09:10 Julien-R44