-
Notifications
You must be signed in to change notification settings - Fork 0
/
sender.go
65 lines (47 loc) · 1.09 KB
/
sender.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package amqp
import (
"github.com/zubairhamed/go-amqp/frames/performatives"
"github.com/zubairhamed/go-amqp/types"
)
func NewSender(name string, ch chan *Event) *Sender {
return &Sender{
Client: Client{
name: name,
ch: ch,
role: ROLE_SENDER,
},
}
}
type Sender struct {
Client
// session *Session
}
func (s *Sender) Send(msg *Message) {
transfer := performatives.NewTransferPerformative()
// 0
transfer.Handle = types.NewHandle(0)
// 0
transfer.DeliveryId = types.NewDeliveryNumber(0)
// 00000000
transfer.DeliveryTag = types.NewDeliveryTag([]byte{0, 0, 0, 0, 0})
// 0
transfer.MessageFormat = types.NewMessageFormat(0)
// false
transfer.Settled = types.NewBoolean(false)
// null
transfer.More = nil
// null
transfer.ReceiverSettleMode = nil
// ?
transfer.State = nil
// nil
transfer.Resume = nil
// nil
transfer.Aborted = nil
// true
transfer.Batchable = types.NewBoolean(true)
// 48 65 6c 6c 6f 20 57 6f 72 6c 64 21
transfer.Value = types.NewAmqpValue(types.NewString("Hello World!"))
LogOut("TRANSFER", "sender")
s.conn.SendPerformative(transfer)
}