ydarias / xk6-nats

This is a K6 extension to be able to test using NATS protocol
MIT License
13 stars 9 forks source link

Feature/add message headers #10

Closed fernandoescolar closed 1 year ago

fernandoescolar commented 1 year ago

Hi,

I have made some enhancements to the repository to support adding headers to NATS messages. This will enable users to include custom headers in their messages and enhance the flexibility and functionality of the NATS integration.

Here's a summary of the changes I've made:

Added the headers property to the Message object received in the subscribe method. This property allows users to access and manipulate the headers of incoming NATS messages.

Implemented a new method called publishWithHeaders that enables users to publish messages with custom headers. This method accepts a header object as a parameter, allowing users to include additional metadata in their messages.

I have thoroughly tested these changes by connecting k6 to a NATS server and verifying that the headers are correctly sent and received.

Please review the changes and let me know if you have any feedback or suggestions.

Thank you for your time and consideration.

fernandoescolar commented 1 year ago

I have just updated this PR trying to solve the open issues: #3 #5 #6 #9

The README.md file has been updated with all the new features.

terradek commented 1 year ago

Hi, @ydarias. I'm wondering if you could merge the PR soon. I'm facing the same problems that was solved in it. @fernandoescolar, do you have any advice on how to build the k6 with the changes from your branch? I don't want to wait for the merge to test them out. Thank you for your work.

ydarias commented 1 year ago

Great, I don't know how I missed it, too many notifications from my work/private repositories I guess. I will take a look this weekend and merge it.

Thank you very much for the hard work!!!!

fernandoescolar commented 1 year ago

... @fernandoescolar, do you have any advice on how to build the k6 with the changes from your branch? I don't want to wait for the merge to test them out. Thank you for your work.

In my tests I'm targeting my fork directly, while this PR is merged: https://github.com/fernandoescolar/xk6-nats

Great, I don't know how I missed it, too many notifications from my work/private repositories I guess. I will take a look this weekend and merge it.

For any improvement or change, here I am... :)

ydarias commented 1 year ago

Thank you @fernandoescolar

The PR is quite nice. Besides two small copy changes the only thing that stops me from merging it right now is that it contains breaking changes for the current users. It is true that returning the connection to be able to close it during tests is the right way to do it.

ydarias commented 1 year ago

I guess we can merge once the copies are updated, it is better to make breaking changes sooner than later 🤷‍♀️ And it is only the subscription that should be easy to solve.

Maybe a note at the readme about that would be nice.

ydarias commented 1 year ago

Perfect, thank you for the fixes @fernandoescolar ... here we go 🚀

fernandoescolar commented 1 year ago

Thanks @ydarias! :)

One more thing, what do you think about creating tags with the version to maintain compatibility?

ydarias commented 1 year ago

That could be a good solution, easy to document, and easy to fix for people who don't want to change their code.

I will create them later and document them at the README.md.

ydarias commented 1 year ago

By the way @fernandoescolar , I am not working on projects using the plugin anymore. If you are using it often, maybe you can be added as a maintainer at this repo so you can also add changes and take decisions on the future of the plugin.