Closed yantrab closed 2 years ago
This issue is related to docker and is out of scope of this project.
If you feel like there is an issue with redis-smq itself then provide a code example to reproduce the issue.
Related to https://github.com/weyoss/redis-smq/issues/88.
@weyoss https://github.com/yantrab/-redis-smq-issue
Just run docker-compose up
.
I test it with a simple get/set from Redis and it works.
You forgot to provide the configuration when creating the producer instance:
https://github.com/yantrab/-redis-smq-issue/blob/d2c0b18f20363cd13eeaa204f8c4b9afd8f585d0/app.ts#L22
Closing as resolved.
I struggled with this a little bit. So just In case anyone else has a similar issue, I'll leave this here for posterity. The main take away in my case was that redis v4 takes a url or socket.host param in the config: https://github.com/redis/node-redis/blob/master/docs/client-configuration.md
package.json
"redis": "^4.3.0",
docker-compose.yml
version: '2'
services:
redis:
image: redis
container_name: redis
expose:
- 6379
producer:
build:
context: .
dockerfile: Dockerfile
container_name: producer
links:
- redis
producer.js
import {RedisClientName} from "redis-smq-common/dist/types";
const config = {
redis: {
client: RedisClientName.REDIS_V4,
options: {
url: 'redis://redis:6379',
}
}
}
OR
const config = {
redis: {
client: RedisClientName.REDIS_V4,
options: {
socket: {
host: "redis"
}
}
}
}
Indeed, do remember to give the config to the Producer, Consumer constructors as well as QueueManager.createInstace() method.
Hope that helps =)
This is my docker-compose file:
And this is my config:
The instance is created without error, but when i execute producer.produce, I get error - [ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379