Permalink
Browse files

ACK error check fires erroneously when more than one message is read.

  • Loading branch information...
1 parent df8c86b commit 205c9572890905dd06003a19b6f775e545c0989a @gmallard committed Dec 16, 2012
Showing with 9 additions and 19 deletions.
  1. +3 −6 ack_10/ack_10.go
  2. +3 −7 ack_11/ack_11.go
  3. +3 −6 ack_12/ack_12.go
View
9 ack_10/ack_10.go
@@ -78,6 +78,9 @@ func main() {
}
//
fmt.Printf("Frame Type: %s\n", m.Message.Command) // Will be MESSAGE or ERROR!
+ if m.Message.Command != stompngo.MESSAGE {
+ log.Fatalln(m) // Handle this ...
+ }
h := m.Message.Headers
for j := 0; j < len(h)-1; j += 2 {
fmt.Printf("Header: %s:%s\n", h[j], h[j+1])
@@ -90,12 +93,6 @@ func main() {
if e != nil {
log.Fatalln(e) // Handle this
}
- // Spurious ERROR frame?
- select {
- case m = <-r:
- log.Fatalln("RECEIVE not expected, got: [%v]\n", m)
- default:
- }
fmt.Println(exampid + "ACK complete ...")
}
// It is polite to unsubscribe, although unnecessary if a disconnect follows.
View
10 ack_11/ack_11.go
@@ -82,6 +82,9 @@ func main() {
}
//
fmt.Printf("Frame Type: %s\n", m.Message.Command) // Will be MESSAGE or ERROR!
+ if m.Message.Command != stompngo.MESSAGE {
+ log.Fatalln(m) // Handle this ...
+ }
h := m.Message.Headers
for j := 0; j < len(h)-1; j += 2 {
fmt.Printf("Header: %s:%s\n", h[j], h[j+1])
@@ -106,14 +109,7 @@ func main() {
if e != nil {
log.Fatalln(e) // Handle this
}
- // Spurious ERROR frame?
- select {
- case m = <-r:
- log.Fatalln("RECEIVE not expected, got: [%v]\n", m)
- default:
- }
fmt.Println(exampid + "ACK complete ...")
-
}
// It is polite to unsubscribe, although unnecessary if a disconnect follows.
// With Stomp 1.1, the same unique ID is required on UNSUBSCRIBE. Failure
View
9 ack_12/ack_12.go
@@ -82,6 +82,9 @@ func main() {
}
//
fmt.Printf("Frame Type: %s\n", m.Message.Command) // Will be MESSAGE or ERROR!
+ if m.Message.Command != stompngo.MESSAGE {
+ log.Fatalln(m) // Handle this ...
+ }
h := m.Message.Headers
for j := 0; j < len(h)-1; j += 2 {
fmt.Printf("Header: %s:%s\n", h[j], h[j+1])
@@ -106,12 +109,6 @@ func main() {
if e != nil {
log.Fatalln(e) // Handle this
}
- // Spurious ERROR frame?
- select {
- case m = <-r:
- log.Fatalln("RECEIVE not expected, got: [%v]\n", m)
- default:
- }
fmt.Println(exampid + "ACK complete ...")
}
// It is polite to unsubscribe, although unnecessary if a disconnect follows.

0 comments on commit 205c957

Please sign in to comment.