Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
im-pool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoyanbin
im-pool
Commits
2b657f5d
Commit
2b657f5d
authored
Apr 04, 2023
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prod conf
parent
41b31de4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
rabbitmq.go
dao/mq/rabbitmq.go
+5
-2
simple.go
dao/mq/simple.go
+2
-2
redis.go
dao/redis/redis.go
+2
-1
ws_server.go
ws_server.go
+1
-1
No files found.
dao/mq/rabbitmq.go
View file @
2b657f5d
...
...
@@ -8,6 +8,9 @@ import (
var
mqUrl
=
"amqp://admin:Dbc_rabbit_mq123@39.97.234.228:5682/"
//var dbname = "im"
var
dbname
=
"imonline"
// 除了simple 模式外、其他的模式都是由 队列 交换机 key 不同组合实现的
type
RabbitMQ
struct
{
conn
*
amqp
.
Connection
...
...
@@ -19,9 +22,9 @@ type RabbitMQ struct {
}
// 创建RabbitMQ 实例
func
newRabbitMQ
(
queueName
,
exchange
,
key
string
)
(
*
RabbitMQ
,
error
)
{
func
newRabbitMQ
(
exchange
,
key
string
)
(
*
RabbitMQ
,
error
)
{
rabbitMQ
:=
&
RabbitMQ
{
QueueName
:
queueN
ame
,
QueueName
:
dbn
ame
,
Exchange
:
exchange
,
Key
:
key
,
MQUrl
:
mqUrl
,
...
...
dao/mq/simple.go
View file @
2b657f5d
...
...
@@ -29,9 +29,9 @@ func (r *RabbitMQ) PublishSimple(message []byte) {
}
// Step 1. Simple 创建实例
func
NewRabbitMQSimple
(
queueName
string
)
*
RabbitMQ
{
func
NewRabbitMQSimple
()
*
RabbitMQ
{
//在simple模式下 exchange and key 都为空
rabbitMQ
,
err
:=
newRabbitMQ
(
queueName
,
""
,
""
)
rabbitMQ
,
err
:=
newRabbitMQ
(
""
,
""
)
if
err
!=
nil
{
fmt
.
Println
(
"NewRabbitMQSimple err:"
,
err
)
return
nil
...
...
dao/redis/redis.go
View file @
2b657f5d
...
...
@@ -6,7 +6,8 @@ import (
)
const
(
host
=
"39.96.85.45"
//host = "39.96.85.45"
host
=
"39.97.179.15"
port
=
6382
password
=
"saas123456"
db
=
6
...
...
ws_server.go
View file @
2b657f5d
...
...
@@ -30,7 +30,7 @@ func main() {
flag
.
Parse
()
pool
.
RabbitMQ
=
mq
.
NewRabbitMQSimple
(
"im"
)
pool
.
RabbitMQ
=
mq
.
NewRabbitMQSimple
()
fmt
.
Println
(
"rabbitMq start success"
)
pool
.
Redis
=
redis
.
Init
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment