Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: convert msg to array msg #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix: convert msg to array msg #24

wants to merge 1 commit into from

Conversation

wwayne
Copy link
Contributor

@wwayne wwayne commented Jan 21, 2020

The method deferPublish in nsq.js doesn't covert msg into msg array code in nsq.js, so sending string msg with delay parameter will get an error from NSQ.

We can force converting msg into array to avoid the bug from nsq.js

@CCharlieLi
Copy link
Contributor

I'm not sure we should convert this implicitly as we are following the same format as NSQ.js https://github.com/dudleycarr/nsqjs#a-writer-example, even though I'm not sure about the intention of sending nsq defer message with a array of string.

Regarding that this is a breaking change, we need to consider potential risk and edge cases of converting message into array. @wwayne

@wwayne
Copy link
Contributor Author

wwayne commented Jan 21, 2020

I think that is a bug from nsq.js, he forgot converting msg to array msg for deferPublish and missed the validation in the unit test, I sent him a PR as well. nsq.js publish and deferPublish method

NSQ itself accepts message array only or it will return an error. So for the nsq-strategy, the example in the README for delay msg actually will get an error

 p.connect((errors) => {
    p.produce('topic', 'message', { retry: {
      retries: 3,
      minTimeout: 300
    }, delay: 2000 }, (err) => {
      if (err) {
        console.log(err);
      }
    });
 });

@CCharlieLi
Copy link
Contributor

FYI, I also found related issue dudleycarr/nsqjs#274

@wwayne
Copy link
Contributor Author

wwayne commented Jan 22, 2020

and I found his PR after I sent mine, for the same issue 🤣
the author seems inactive in the maintaining

@xavierchow xavierchow mentioned this pull request Feb 22, 2022
@xavierchow
Copy link
Member

xavierchow commented Feb 22, 2022

closing, we only need to use nsqjs 0.13.0

hmm, figured out dudleycarr/nsqjs#275 is not merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants