redis-smq
Version:
A high-performance, reliable, and scalable message queue for Node.js.
15 lines • 729 B
JavaScript
import { async } from 'redis-smq-common';
import { redisKeys } from '../../common/redis/redis-keys/redis-keys.js';
import { propertyConfigs } from './_parse-message-state.js';
export function _getMessageStateProperty(redisClient, messageId, property, cb) {
const { keyMessage } = redisKeys.getMessageKeys(messageId);
async.withCallback((cb) => redisClient.hget(keyMessage, String(property), cb), (value, cb) => {
const config = propertyConfigs[property];
if (!config) {
return cb(new Error(`Could not find property '${property}'`));
}
const parsedValue = config.parser(value);
cb(null, parsedValue);
}, cb);
}
//# sourceMappingURL=_get-message-state-property.js.map