Rabbitmq??Kafka???????????
???????????? ???????[ 2016/3/9 13:17:57 ] ??????????????? ???????
????rabbitmq:
package main
import (
"github.com/streadway/amqp"
"time"
"fmt"
"log"
)
const (
queueName = "push.msg.q"
exchange = "t.msg.ex"
mqurl ="amqp://shimeng:shimeng1015@192.168.155.106:5672/push"
)
var conn *amqp.Connection
var channel *amqp.Channel
func main() {
fmt.Println(1)
// push()
receive()
// fmt.Println("end")
// close()
}
func failOnErr(err error?? msg string) {
if err != nil {
log.Fatalf("%s:%s"?? msg?? err)
panic(fmt.Sprintf("%s:%s"?? msg?? err))
}
}
func mqConnect() {
var err error
conn?? err = amqp.Dial(mqurl)
if err != nil {
log.Println(1)
log.Fatalln(err)
}
fmt.Println(5)
channel?? err = conn.Channel()
if err != nil {
fmt.Println(2)
log.Fatalln(err)
}else {
fmt.Println("a")
}
}
func push() {
count := 0
if channel == nil {
fmt.Println(2)
mqConnect()
}else {
fmt.Println(3)
}
msgContent := "hello world!"
t1 := time.NewTicker(time.Second)
go func() {
for{
<- t1.C
log.Println(count)
}
}()
for{
err := channel.Publish(exchange?? "test"?? false?? false?? amqp.Publishing{
ContentType: "text/plain"??
Body: []byte(msgContent)??
})
if err != nil {
}else {
count ++
}
}
}
func receive() {
if channel == nil {
mqConnect()
}
count :=0
msgs?? err := channel.Consume(queueName?? ""?? true?? false?? false?? false?? nil)
failOnErr(err?? "")
forever := make(chan bool)
t1 := time.NewTicker(time.Second)
go func() {
for{
<- t1.C
log.Println(count)
}
}()
go func() {
//fmt.Println(*msgs)
for _= range msgs {
count ++
// s := BytesToString(&(d.Body))
// count++
// fmt.Printf("receve msg is :%s -- %d "?? *s?? count)
}
}()
fmt.Printf(" [*] Waiting for messages. To exit press CTRL+C ")
<-forever
}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??????????????????????????????????APP?????????????????????????????????????????SQL??????????????Щ????????????????????????????????????????????????????????????????????????Web????????????????????????????????????????????????????漰????????????????????????????????Java???????????Щ??????????????????????????????????????????????????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????