Skip to content

Commit ce8b6e8

Browse files
committed
Correct use of Inq() in samples - issue #107
1 parent f015e2b commit ce8b6e8

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Changelog
22
Newest updates are at the top of this file.
33

4-
## May 31 2019
4+
## May 31 2019 - v4.0.6
55
* mqmetric - Allow limited monitoring of V8 Distributed platforms
66
(set `ibmmq.usePublications` to *false* to enable in monitor programs) #104
77
* mqmetric - Added queue_attribute_max_depth to permit %full calculation
88
(set `ibmmq.useStatus` to *true* to enable in monitor programs) #105
9+
* samples - Correct use of the new form of the Inq() verb
910

1011
## April 23 2019
1112
* Fixed memory leak in InqMP

buildInDocker.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ do
4444
echo "Building program: $exe"
4545
go build -o bin/$exe $samp
4646
done
47+
48+
echo "Building program: mqitest"
49+
go build -o bin/mqitest $srcdir/mqitest/mqitest.go

samples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Current samples in this directory include
2828
* amqsconn.go: How to programmatically connect as an MQ client to a remote queue manager.
2929
Allow use of a userid/password for authentication. There are no default values for this sample.
3030
* amqsprop.go: Set and extract message properties
31-
* amqsinq.go : Demonstrate the new InqMap API for inquiring about object attributes
31+
* amqsinq.go : Demonstrate the Inq API for inquiring about object attributes
3232
* amqsset.go : Demonstrate how to set attributes of an MQ object using the MQSET verb
3333
* amqscb.go : Demonstrate use of the CALLBACK capability for asynchronous consumption of messages
3434

samples/amqsinq.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var object ibmmq.MQObject
4444
*/
4545
func inquire(obj ibmmq.MQObject, selectors []int32) {
4646
// This is the function to do the actual inquiry
47-
values, err := obj.InqMap(selectors)
47+
values, err := obj.Inq(selectors)
4848
if err != nil {
4949
fmt.Println(err)
5050
} else {

samples/mqitest/mqitest.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
"fmt"
4242
"os"
4343
"strings"
44+
"time"
4445

4546
"github.com/ibm-messaging/mq-golang/ibmmq"
4647
)
@@ -102,7 +103,7 @@ func main() {
102103
pmo.Options = ibmmq.MQPMO_SYNCPOINT | ibmmq.MQPMO_NEW_MSG_ID | ibmmq.MQPMO_NEW_CORREL_ID
103104

104105
putmqmd.Format = "MQSTR"
105-
msgData := "Hello from Go"
106+
msgData := "Hello from Go at " + time.Now().Format("02 Jan 2006 03:04:05")
106107
buffer := []byte(msgData)
107108

108109
err = qObject.Put(putmqmd, pmo, buffer)
@@ -247,15 +248,14 @@ func main() {
247248
ibmmq.MQCA_DEAD_LETTER_Q_NAME,
248249
ibmmq.MQIA_MSG_MARK_BROWSE_INTERVAL}
249250

250-
intAttrs, charAttrs, err := qMgrObject.Inq(selectors, 2, 160)
251+
values, err := qMgrObject.Inq(selectors)
251252

252253
if err != nil {
253254
fmt.Println(err)
254255
} else {
255-
returnedName := string(charAttrs[0:48])
256-
fmt.Printf("MQINQ returned +%v %s \n",
257-
intAttrs, string(charAttrs))
258-
fmt.Printf(" '%s'\n", returnedName)
256+
returnedName := values[ibmmq.MQCA_Q_MGR_NAME]
257+
fmt.Printf("MQINQ returned %v \n", values)
258+
fmt.Printf(" QM is '%s'\n", returnedName)
259259
}
260260

261261
}

0 commit comments

Comments
 (0)