PROTON-1390: Fix message body output in examples

Print message body as %v, not messages as %#v to give readable example output.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/71e567d9
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/71e567d9
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/71e567d9

Branch: refs/heads/go1
Commit: 71e567d90d2a123bb323320e1c308a5e3180d26b
Parents: eafd081
Author: Alan Conway <[email protected]>
Authored: Tue Jan 17 20:07:43 2017 -0500
Committer: Alan Conway <[email protected]>
Committed: Tue Jan 17 20:07:43 2017 -0500

----------------------------------------------------------------------
 examples/go/electron/broker.go  | 6 +++---
 examples/go/electron/receive.go | 2 +-
 examples/go/electron/send.go    | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e567d9/examples/go/electron/broker.go
----------------------------------------------------------------------
diff --git a/examples/go/electron/broker.go b/examples/go/electron/broker.go
index 9228195..ba06e89 100644
--- a/examples/go/electron/broker.go
+++ b/examples/go/electron/broker.go
@@ -146,7 +146,7 @@ func (c *connection) receiver(receiver electron.Receiver) {
        q := c.broker.queues.Get(receiver.Target())
        for {
                if rm, err := receiver.Receive(); err == nil {
-                       debugf("%v: received %v %#v", receiver, rm.Message)
+                       debugf("%v: received %v", receiver, rm.Message.Body())
                        q <- rm.Message
                        rm.Accept()
                } else {
@@ -167,7 +167,7 @@ func (c *connection) sender(sender electron.Sender) {
                select {
 
                case m := <-q:
-                       debugf("%v: sent %#v", sender, m)
+                       debugf("%v: sent %v", sender, m.Body())
                        sm := sentMessage{m, q}
                        c.broker.sent <- sm                    // Record sent 
message
                        sender.SendAsync(m, c.broker.acks, sm) // Receive 
outcome on c.broker.acks with Value sm
@@ -198,7 +198,7 @@ func (b *broker) acknowledgements() {
                        delete(sentMap, sm)
                        if outcome.Status != electron.Accepted { // Error, 
release or rejection
                                sm.q.PutBack(sm.m) // Put the message back on 
the queue.
-                               debugf("message %#v put back, status %v, error 
%v", sm.m, outcome.Status, outcome.Error)
+                               debugf("message %v put back, status %v, error 
%v", sm.m.Body(), outcome.Status, outcome.Error)
                        }
                }
        }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e567d9/examples/go/electron/receive.go
----------------------------------------------------------------------
diff --git a/examples/go/electron/receive.go b/examples/go/electron/receive.go
index 161e911..37a8583 100644
--- a/examples/go/electron/receive.go
+++ b/examples/go/electron/receive.go
@@ -101,7 +101,7 @@ func main() {
        // print each message until the count is exceeded.
        for i := uint64(0); i < *count; i++ {
                m := <-messages
-               debugf("%#v\n", m)
+               debugf("%v\n", m.Body())
        }
        fmt.Printf("Received %d messages\n", *count)
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e567d9/examples/go/electron/send.go
----------------------------------------------------------------------
diff --git a/examples/go/electron/send.go b/examples/go/electron/send.go
index 9ab5f1c..f478f4b 100644
--- a/examples/go/electron/send.go
+++ b/examples/go/electron/send.go
@@ -77,7 +77,7 @@ func main() {
                                                // Loop sending messages.
                                                for i := int64(0); i < *count; 
i++ {
                                                        m := amqp.NewMessage()
-                                                       body := 
fmt.Sprintf("%v-%v", url.Path, i)
+                                                       body := 
fmt.Sprintf("%v%v", url.Path, i)
                                                        m.Marshal(body)
                                                        s.SendAsync(m, 
sentChan, body) // Outcome will be sent to sentChan
                                                }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to