Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
golang-queue-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2bf56014
authored
Apr 17, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
up
parent
aa3f3b39
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
32 deletions
go.mod
go.sum
order/sendPurchaseEmail/main.go
go.mod
View file @
2bf56014
...
...
@@ -9,9 +9,10 @@ require (
github.com/go-sql-driver/mysql v1.4.1
github.com/gomodule/redigo v2.0.0+incompatible
github.com/ichunt2019/go-msgserver v1.0.4
github.com/ichunt2019/go-rabbitmq v1.0.1 // indirect
github.com/ichunt2019/logger v1.0.5
github.com/jmoiron/sqlx v1.2.0
github.com/prometheus/common v0.7.0 // indirect
github.com/streadway/amqp v0.0.0-20
190827072141-edfb9018d2
71
github.com/streadway/amqp v0.0.0-20
200108173154-1c71cc93ed
71
github.com/tealeg/xlsx v1.0.5
)
go.sum
View file @
2bf56014
...
...
@@ -35,6 +35,8 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
github.com/ichunt2019/go-msgserver v1.0.4 h1:4BsRE1Ca4J0h9xyDqUF0pRMpMjDC5G7023hESrzszsY=
github.com/ichunt2019/go-msgserver v1.0.4/go.mod h1:fWAvbry0W9nhmkqgT2agwRqYCWlguUJXgy2rgoWOUmA=
github.com/ichunt2019/go-msgserver v1.0.5 h1:yanQ95Ld0etJzVhyZql0jhXXE18qGFX48qFgTCim5hg=
github.com/ichunt2019/go-rabbitmq v1.0.1 h1:qHhpGm9v7jnhSBo3f3viX+BSky9yugp9lCSV03eYsF4=
github.com/ichunt2019/go-rabbitmq v1.0.1/go.mod h1:TQsZ1XWULyvm4UwpYHwNPtOXYbuVvLLI0GM7g/BRy68=
github.com/ichunt2019/logger v1.0.3 h1:sH4HfpzYIP9jGGx2AGqN1vRMaph299jB5/L7mwfUMwY=
github.com/ichunt2019/logger v1.0.3/go.mod h1:5IWMrrqJIWwOIGav9ACWOI+KOuYeteUvOei4zubclwg=
github.com/ichunt2019/logger v1.0.4 h1:y8xfaOLk/5Q++YBoq3x+NCf5Z4WpsQe4juCD2n/ul14=
...
...
@@ -79,6 +81,8 @@ github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271 h1:WhxRHzgeVGETMlmVfqhRn8RIeeNoPr2Czh33I4Zdccw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20200108173154-1c71cc93ed71 h1:2MR0pKUzlP3SGgj5NYJe/zRYDwOu9ku6YHy+Iw7l5DM=
github.com/streadway/amqp v0.0.0-20200108173154-1c71cc93ed71/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
...
...
order/sendPurchaseEmail/main.go
View file @
2bf56014
...
...
@@ -2,14 +2,15 @@ package main
import
(
"flag"
"fmt"
"github.com/ichunt2019/go-msgserver/utils/rabbitmq"
_
"fmt"
_
"github.com/ichunt2019/go-msgserver/utils/rabbitmq"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/ichunt2019/logger"
"go-queue-server/dal/db"
"go-queue-server/order/sendPurchaseEmail/sendEmail"
"go-queue-server/util"
"sync"
"time"
_
"sync"
_
"time"
)
...
...
@@ -77,13 +78,13 @@ func main() {
t
:=
&
RecvPro
{}
queueExchange
:=
&
rabbitmq
.
QueueExchange
{
util
.
Configs
.
Rabbitmq_ichunt
.
QueueName
,
util
.
Configs
.
Rabbitmq_ichunt
.
RoutingKey
,
util
.
Configs
.
Rabbitmq_ichunt
.
Exchange
,
util
.
Configs
.
Rabbitmq_ichunt
.
Type
,
util
.
Configs
.
Rabbitmq_ichunt
.
Dns
,
}
//
queueExchange := &rabbitmq.QueueExchange{
//
util.Configs.Rabbitmq_ichunt.QueueName,
//
util.Configs.Rabbitmq_ichunt.RoutingKey,
//
util.Configs.Rabbitmq_ichunt.Exchange,
//
util.Configs.Rabbitmq_ichunt.Type,
//
util.Configs.Rabbitmq_ichunt.Dns,
//
}
//for i:=0;i<= 100;i++{
// logger.Debug("Debug记录日志555555555555555555555555555555")
...
...
@@ -94,24 +95,32 @@ func main() {
// logger.Fatal("Fatal记录日志555555555555555555555555555555")
//}
for
{
var
wg
sync
.
WaitGroup
fmt
.
Println
(
"开始执行任务...."
)
for
i
:=
0
;
i
<
3
;
i
++
{
wg
.
Add
(
1
)
go
func
(
wg
*
sync
.
WaitGroup
){
mq
:=
rabbitmq
.
New
(
queueExchange
)
mq
.
RegisterReceiver
(
t
)
err
:=
mq
.
Start
()
if
err
!=
nil
{
fmt
.
Println
(
err
)
}
wg
.
Done
()
}(
&
wg
)
}
wg
.
Wait
()
fmt
.
Println
(
"执行任务完成...."
)
time
.
Sleep
(
time
.
Microsecond
*
10
)
}
//for{
// var wg sync.WaitGroup
// fmt.Println("开始执行任务....")
// for i := 0;i<3;i++{
// wg.Add(1)
// go func(wg *sync.WaitGroup){
// mq := rabbitmq.New(queueExchange)
// mq.RegisterReceiver(t)
// err :=mq.Start()
// if err != nil{
//
// fmt.Println(err)
// }
// wg.Done()
// }(&wg)
// }
// wg.Wait()
// fmt.Println("执行任务完成....")
// time.Sleep(time.Microsecond*10)
//}
rabbitmq
.
Recv
(
rabbitmq
.
QueueExchange
{
util
.
Configs
.
Rabbitmq_ichunt
.
QueueName
,
util
.
Configs
.
Rabbitmq_ichunt
.
RoutingKey
,
util
.
Configs
.
Rabbitmq_ichunt
.
Exchange
,
util
.
Configs
.
Rabbitmq_ichunt
.
Type
,
util
.
Configs
.
Rabbitmq_ichunt
.
Dns
,
},
t
,
3
)
}
\ No newline at end of file
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