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

data without "payload" property #20

Open
trx222 opened this issue Jun 14, 2022 · 2 comments
Open

data without "payload" property #20

trx222 opened this issue Jun 14, 2022 · 2 comments

Comments

@trx222
Copy link

trx222 commented Jun 14, 2022

Hi. Is There a way to add the job data without the property "payload" ? This makes it possibly incompatible if you want to use this library together with others that puts data objects ( or pure strings ? ) directly to the job contents.

If I spawn a job with the lib it looks like this:

{
    "payload":{
        "ax":"xyz"
    }
}

but I expect it like this:

{
     "ax":"xyz"
}

Code is from your example:

worker.spawn(tube, {
  ax: "xyz" // job payload/values
}, {
  delay: 0,
  priority: 1000,
  timeout: 10 * 60 * 1000 // ms
}).then(function (job) {
  console.log(job.id);
});
@mickhansen
Copy link
Contributor

We wrap the object here: https://github.com/burstable/node-beanstalkd-worker/blob/master/src/spawn.js#L31

There was some reason for this, originally, years ago - Perhaps to carry across arbitrary options.
Looking at the code I don't believe this is necessary anymore, we could do away with the payload key but we'd have to do a major release since this might be a breaking change.

@trx222
Copy link
Author

trx222 commented Jun 14, 2022

ok, thanks for the fast response 👍🏼

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

No branches or pull requests

2 participants