Skip to content

Commit 945da5f

Browse files
committed
Update README and sample
1 parent 1935248 commit 945da5f

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
=======
4+
### October 2018
5+
* Allow compilation against MQ v8
6+
37
## October 2018 - v3.0.0
48
* Added functions to the mqmetric package to assist with collecting channel status
59
* Better handle truncated messages when listing the queues that match a pattern

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ This repository demonstrates how you can call IBM MQ from applications written i
66
77
This repository previously contained sample programs that exported MQ statistics to some monitoring packages. These have now been moved to a new [GitHub repository called mq-metric-samples](https://github.com/ibm-messaging/mq-metric-samples).
88

9-
A minimum level of MQ V9 is required to build these packages.
10-
The monitoring data published by the queue manager is not available before that version; the interface also assumes availability of MQI structures from that level of MQ.
9+
A minimum level of MQ V8 is required to build these packages.
10+
However, note that the monitoring data published by the queue manager is not available before MQ V9.
1111

1212
## Health Warning
1313

ibmmq/mqiMQCNO.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@ void freeCCDTUrl(MQCNO *mqcno) {
3636
3737
void setCCDTUrl(MQCNO *mqcno, PMQCHAR url, MQLONG length) {
3838
#if defined(MQCNO_VERSION_6) && MQCNO_CURRENT_VERSION >= MQCNO_VERSION_6
39-
mqcno->Version = MQCNO_VERSION_6;
39+
if (mqcno->Version < MQCNO_VERSION_6) {
40+
mqcno->Version = MQCNO_VERSION_6;
41+
}
4042
mqcno->CCDTUrlOffset = 0;
4143
mqcno->CCDTUrlPtr = NULL;
4244
mqcno->CCDTUrlLength = length;
4345
if (url != NULL) {
4446
mqcno->CCDTUrlPtr = url;
4547
}
4648
#else
47-
mqcno->Version = MQCNO_CURRENT_VERSION;
4849
if (url != NULL) {
4950
free(url);
5051
}
@@ -177,6 +178,9 @@ func copyCNOtoC(mqcno *C.MQCNO, gocno *MQCNO) {
177178
mqcno.SecurityParmsPtr = nil
178179
}
179180

181+
// The CCDT URL option was introduced in MQ V9. To compile against older
182+
// versions of MQ, setting of it has been moved to a C function that can use
183+
// the pre-processor to decide whether it's needed.
180184
C.setCCDTUrl(mqcno, C.PMQCHAR(C.CString(gocno.CCDTUrl)), C.MQLONG(len(gocno.CCDTUrl)))
181185
return
182186
}

samples/clientconn/clientconn.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,16 @@ func main() {
7777
// Reference the CD structure from the CNO
7878
// and indicate that we want to use the client
7979
// connection method.
80-
cno.ClientConn = cd
80+
if true {
81+
cno.ClientConn = cd
82+
} else {
83+
// This is how you might reference a remote CCDT instead of
84+
// explicitly putting in the CD structure.
85+
cno.CCDTUrl = "http://localhost:3030"
86+
}
8187
cno.Options = ibmmq.MQCNO_CLIENT_BINDING
8288

89+
8390
// Also fill in the userid and password if the MQSAMP_USER_ID
8491
// environment variable is set. This is the same as the C
8592
// sample programs such as amqsput.

0 commit comments

Comments
 (0)