Skip to content

Commit

Permalink
添加redis支持
Browse files Browse the repository at this point in the history
  • Loading branch information
thousmile committed Feb 1, 2024
1 parent bb4d224 commit 76fbe70
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ redisConfig:
# message send method "queue or direct", default: queue
# queue: after receiving the message, enter the queue and send it in batch when the queue conditions are met.
# direct: send immediately after receiving the message
# info: rabbitmq queue send is not supported
# info: Rabbitmq and Redis do not support queue
sendMethod: queue


Expand All @@ -80,7 +80,7 @@ queue:
docker run -d --name go_emqx_exhook -p 16565:16565 \
-v /etc/go_emqx_exhook/config.yaml:/apps/config.yaml \
-v /etc/localtime:/etc/localtime:ro \
--restart=always thousmile/go_emqx_exhook:1.4
--restart=always thousmile/go_emqx_exhook:1.5
```

vim docker-compose.yml
Expand All @@ -97,7 +97,7 @@ networks:

services:
go_emqx_exhook:
image: thousmile/go_emqx_exhook:1.4
image: thousmile/go_emqx_exhook:1.5
container_name: go_emqx_exhook
ports:
- "16565:16565"
Expand Down Expand Up @@ -140,18 +140,18 @@ goreleaser --snapshot --skip-publish --clean


# build docker image
docker build -t go_emqx_exhook:1.4 ./
docker build -t go_emqx_exhook:1.5 ./


# run docker container
docker run -d --name go_emqx_exhook -p 16565:16565 --restart=always go_emqx_exhook:1.4
docker run -d --name go_emqx_exhook -p 16565:16565 --restart=always go_emqx_exhook:1.5


## custom configuration file
docker run -d --name go_emqx_exhook -p 16565:16565 \
-v /etc/go_emqx_exhook/config.yaml:/apps/config.yaml \
-v /etc/localtime:/etc/localtime:ro \
--restart=always thousmile/go_emqx_exhook:1.4
--restart=always thousmile/go_emqx_exhook:1.5

```

Expand All @@ -170,6 +170,9 @@ docker run -d --name go_emqx_exhook -p 16565:16565 \



Redis:
![](./images/20240201103222.png)

Rabbitmq:
![](./images/20231207160607.png)

Expand Down
15 changes: 9 additions & 6 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ redisConfig:
# 发送方式 queue 或者 direct ,默认 queue
# queue: 收到消息后,转入队列,当队列内的消息数量等于阈值,批量发送到mq中
# direct: 收到消息后,立即发送到mq中
# 注: rabbitmq 不支持队列发送
# 注: rabbitmq 和 redis 不支持队列发送
sendMethod: queue

# 队列的配置, batchSize 和 lingerTime 只要满足一个,就将消息批量发送到mq中
Expand All @@ -77,7 +77,7 @@ queue:
docker run -d --name go_emqx_exhook -p 16565:16565 \
-v /etc/go_emqx_exhook/config.yaml:/apps/config.yaml \
-v /etc/localtime:/etc/localtime:ro \
--restart=always thousmile/go_emqx_exhook:1.4
--restart=always thousmile/go_emqx_exhook:1.5
```

vim docker-compose.yml
Expand All @@ -94,7 +94,7 @@ networks:

services:
go_emqx_exhook:
image: thousmile/go_emqx_exhook:1.4
image: thousmile/go_emqx_exhook:1.5
container_name: go_emqx_exhook
ports:
- "16565:16565"
Expand Down Expand Up @@ -137,18 +137,18 @@ goreleaser --snapshot --skip-publish --clean


## 构建docker镜像
docker build -t go_emqx_exhook:1.4 ./
docker build -t go_emqx_exhook:1.5 ./


## 运行docker容器
docker run -d --name go_emqx_exhook -p 16565:16565 --restart=always go_emqx_exhook:1.4
docker run -d --name go_emqx_exhook -p 16565:16565 --restart=always go_emqx_exhook:1.5


## 指定配置文件
docker run -d --name go_emqx_exhook -p 16565:16565 \
-v /etc/go_emqx_exhook/config.yaml:/apps/config.yaml \
-v /etc/localtime:/etc/localtime:ro \
--restart=always thousmile/go_emqx_exhook:1.4
--restart=always thousmile/go_emqx_exhook:1.5

```

Expand All @@ -167,6 +167,9 @@ docker run -d --name go_emqx_exhook -p 16565:16565 \



Redis:
![](./images/20240201103222.png)

Rabbitmq:
![](./images/20231207160607.png)

Expand Down
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ mqType: Redis

bridgeRule:
topics:
- "/hello/test"
- "/#"

redisConfig:
addresses:
- 192.168.0.188:6379
streamName: emqx_exhook
db: 2
db: 0
4 changes: 2 additions & 2 deletions config.yaml.bak
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ kafkaConfig:
password: 123456


# redis 配置,需要提前创建 stream (emqx_exhook)
# redis 配置
redisConfig:
addresses:
- 127.0.0.1:6379
Expand All @@ -51,7 +51,7 @@ redisConfig:


# 发送方式 queue or direct ,默认 queue
# 注: rabbitmq 不支持队列发送
# 注: redis 和 rabbitmq 不支持队列发送
sendMethod: queue


Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/IBM/sarama v1.42.1
github.com/apache/rocketmq-client-go/v2 v2.1.2
github.com/redis/go-redis/v9 v9.4.0
github.com/wagslane/go-rabbitmq v0.12.4
github.com/spf13/viper v1.17.0
github.com/wagslane/go-rabbitmq v0.12.4
github.com/xdg-go/scram v1.1.2
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
Expand Down
Binary file added images/20240201103222.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 76fbe70

Please sign in to comment.