|
|
@@ -122,6 +122,13 @@ func (receiver Receiver) MmReceive(args Args, reply *Reply) error {
|
|
122
|
122
|
return nil
|
|
123
|
123
|
}
|
|
124
|
124
|
|
|
|
125
|
+func (moscato *Moscato) CheckQueue() MsgUnit {
|
|
|
126
|
+ for {
|
|
|
127
|
+ pmMsg := moscato.queue.pop(true)
|
|
|
128
|
+ fmt.Println("queue popped : ", pmMsg)
|
|
|
129
|
+ }
|
|
|
130
|
+}
|
|
|
131
|
+
|
|
125
|
132
|
//Recieve - MM가 msg전달 받음
|
|
126
|
133
|
func (moscato *Moscato) Receive(msg MsgUnit) (MsgUnit, error) {
|
|
127
|
134
|
//rpc call
|
|
|
@@ -133,7 +140,6 @@ func (moscato *Moscato) Receive(msg MsgUnit) (MsgUnit, error) {
|
|
133
|
140
|
|
|
134
|
141
|
case PM: //Publish msg
|
|
135
|
142
|
moscato.queue.push(msg.(PublishMsg))
|
|
136
|
|
- log.Println("popped queue: ", moscato.queue.pop(false))
|
|
137
|
143
|
log.Println("PM received")
|
|
138
|
144
|
|
|
139
|
145
|
case SM: //Subscription msg
|
|
|
@@ -197,6 +203,7 @@ func (moscato *Moscato) Run() {
|
|
197
|
203
|
|
|
198
|
204
|
//go routine -> matching 동작
|
|
199
|
205
|
go moscato.match_mng.matching(&moscato.queue)
|
|
|
206
|
+ go moscato.CheckQueue()
|
|
200
|
207
|
|
|
201
|
208
|
//rpc 등록 -> Receive 함수
|
|
202
|
209
|
err = rpc.Register(receiver)
|
|
|
@@ -204,6 +211,7 @@ func (moscato *Moscato) Run() {
|
|
204
|
211
|
log.Println(err)
|
|
205
|
212
|
return
|
|
206
|
213
|
}
|
|
|
214
|
+
|
|
207
|
215
|
Listen()
|
|
208
|
216
|
log.Println("listen complete.")
|
|
209
|
217
|
fmt.Scanln()
|