Hello,
Is there a way to have a callback for xadd something like:
redisClient.xadd(streamName, '*',....,function(err,resp){
console.log(resp);
});
I tried and had errors.
Thanks!
Mike
@mikeslim7 this exists. Can you please post real code (instead ....
) as I think it might just be an small error.
I have an error than call
redisClient.xadd('mystream', '*', 'field1', 'm1', function (err) {
});
{ ReplyError: ERR unknown command `xadd`, with args beginning with: `mystream`, `*`, `field1`, `m1`,
at parseError (/home/work/node_modules/redis-parser/lib/parser.js:193:12)
at parseType (/home/work/node_modules/redis-parser/lib/parser.js:303:14)
command: 'XADD',
args: [ 'mystream', '*', 'field1', 'm1' ],
code: 'ERR' }
@protectedvar You have a version of Redis that doesn't support streams (unrelated to this issue).
@stockholmux Does v2.8.0 support xadd callback?
@gcobcqwe Yes.
I have the same problem with the latest version node_redis (2.8.0?). I also tried to directly use the master branch, with throws the same error.
The following code does not run.
const rdb = redis.createClient("redis://localhost:6379");
const send = promisify(rdb.sendCommand).bind(rdb);
const n = {forename: "foo", lastname: "bar"};
send(`XADD nameStream * ${JSON.stringify(n)}`).catch(e => console.error(e));
ReplyError: ERR unknown command xadd namestream * {"forename":"foo","lastname":"bar"}
, with args beginning with:
at parseError (/Users/hendrik/git/ownprojects/databroker/node_modules/redis-parser/lib/parser.js:193:12)
at parseType (/Users/hendrik/git/ownprojects/databroker/node_modules/redis-parser/lib/parser.js:303:14) {
command: 'XADD NAMESTREAM * {"FORENAME":"FOO","LASTNAME":"BAR"}',
code: 'ERR'
}
Hey, @hbel. I think your format is incorrect.
XADD mystream * field1 value1 field2 value2 field3 value3
https://redis.io/commands/xadd
The error posted here indicates the error came directly from the Redis server, not from the client. Thus, I am closing this issue.