From 2791139f069a5efeab93d35666e6cd7122134cf7 Mon Sep 17 00:00:00 2001 From: ibmmqmet Date: Thu, 21 Mar 2019 07:50:44 +0000 Subject: [PATCH] MQ V9.1.2 support --- CHANGELOG.md | 9 +++ Dockerfile-build-samples | 4 +- README.md | 4 +- ibmmq/cmqc_darwin.go | 33 ++++++--- ibmmq/cmqc_linux_amd64.go | 33 ++++++--- ibmmq/cmqc_linux_ppc64le.go | 33 ++++++--- ibmmq/cmqc_linux_s390x.go | 33 ++++++--- ibmmq/cmqc_windows.go | 33 ++++++--- ibmmq/mqi.go | 37 +++++++---- ibmmq/mqiMQCNO.go | 47 ++++++++++++- mqmetric/channel.go | 45 ++++++++++--- mqmetric/discover.go | 14 ++-- mqmetric/mqif.go | 9 ++- mqmetric/queue.go | 6 +- samples/README.md | 6 +- samples/amqsconn.go | 6 +- samples/amqsconntls.go | 129 ++++++++++++++++++++++++++++++++++++ samples/amqspub.go | 10 +-- samples/amqssub.go | 8 +-- samples/pubsub.sh | 4 +- 20 files changed, 402 insertions(+), 101 deletions(-) create mode 100644 samples/amqsconntls.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 3359ff1..fcb128d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,13 @@ # Changelog +Newest updates are at the top of this file. + +## March 20 2019 - v4.0.0 +* Update for MQ 9.1.2 - ApplName now settable during Connect +* BREAKING API: deprecated Inq()/MQINQ implementation replaced. +* Fixes to callback functions for EVENT processing +* mqmetric - Improve handling of z/OS channel status where multiple instances of the same name +* mqmetric - More accurate testing of model queue default maxdepth for status replies +* mqmetric - Was ignoring an error in subscription processing ## January 24 2019 * Deal with callback functions being called unexpectedly (#75) diff --git a/Dockerfile-build-samples b/Dockerfile-build-samples index 9c8a8f9..9b3900d 100644 --- a/Dockerfile-build-samples +++ b/Dockerfile-build-samples @@ -19,8 +19,6 @@ FROM $BASE_IMAGE RUN mkdir -p "$GOPATH/src/github.com/ibm-messaging/mq-golang/samples" WORKDIR $GOPATH/src/github.com/ibm-messaging/mq-golang/samples -COPY ./samples/clientconn clientconn COPY ./samples/mqitest mqitest -RUN go install ./clientconn \ - && go install ./mqitest +RUN go install ./mqitest diff --git a/README.md b/README.md index 91d79eb..7d1dbba 100755 --- a/README.md +++ b/README.md @@ -115,9 +115,7 @@ For example, export CGO_CFLAGS="-I$MQ_INSTALLATION_PATH/inc" - export CGO_LDFLAGS="-L$MQ_INSTALLATION_PATH/lib64 -Wl,rpath=$MQ_INSTALLATION_PATH/lib64" - or on Darwin - export CGO_LDFLAGS="-L$MQ_INSTALLATION_PATH/lib64 -Wl,rpath,$MQ_INSTALLATION_PATH/lib64" + export CGO_LDFLAGS="-L$MQ_INSTALLATION_PATH/lib64 -Wl,-rpath,$MQ_INSTALLATION_PATH/lib64" ``` * Compile the `ibmmq` component: diff --git a/ibmmq/cmqc_darwin.go b/ibmmq/cmqc_darwin.go index 31427b0..800528a 100644 --- a/ibmmq/cmqc_darwin.go +++ b/ibmmq/cmqc_darwin.go @@ -14,7 +14,7 @@ package ibmmq * for each value; those can be found in other header files such as * cmqc.h. **************************************************************** -* Copyright (c) IBM Corporation 1993, 2018 +* Copyright (c) IBM Corporation 1993, 2019 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,8 @@ package ibmmq **************************************************************** * * -* Generated on: 112018 5:02 PM -* Build Level: p911-L181120.1 +* Generated on: 3/8/19 4:14 PM +* Build Level: p912-L190308 * Build Type: Production * */ @@ -194,7 +194,7 @@ var ( MQBACF_FIRST int32 = 7001 MQBACF_GENERIC_CONNECTION_ID int32 = 7007 MQBACF_GROUP_ID int32 = 7012 - MQBACF_LAST_USED int32 = 7035 + MQBACF_LAST_USED int32 = 7037 MQBACF_MESSAGE_DATA int32 = 7020 MQBACF_MQBO_STRUCT int32 = 7021 MQBACF_MQCBC_STRUCT int32 = 7023 @@ -209,7 +209,9 @@ var ( MQBACF_MQSTS_STRUCT int32 = 7031 MQBACF_MSG_ID int32 = 7013 MQBACF_ORIGIN_UOW_ID int32 = 7008 + MQBACF_PROPERTIES_DATA int32 = 7037 MQBACF_Q_MGR_UOW_ID int32 = 7009 + MQBACF_REQUEST_ID int32 = 7036 MQBACF_RESPONSE_ID int32 = 7004 MQBACF_RESPONSE_SET int32 = 7003 MQBACF_SUB_CORREL_ID int32 = 7032 @@ -851,6 +853,7 @@ var ( MQCFT_REPORT int32 = 12 MQCFT_RESPONSE int32 = 2 MQCFT_STATISTICS int32 = 21 + MQCFT_STATUS int32 = 27 MQCFT_STRING int32 = 4 MQCFT_STRING_FILTER int32 = 14 MQCFT_STRING_LIST int32 = 6 @@ -979,7 +982,7 @@ var ( MQCMDI_SEC_SIGNOFF_ERROR int32 = 17 MQCMDI_SEC_TIMER_ZERO int32 = 14 MQCMDI_SEC_UPPERCASE int32 = 21 - MQCMDL_CURRENT_LEVEL int32 = 911 + MQCMDL_CURRENT_LEVEL int32 = 912 MQCMDL_LEVEL_1 int32 = 100 MQCMDL_LEVEL_101 int32 = 101 MQCMDL_LEVEL_110 int32 = 110 @@ -1016,6 +1019,7 @@ var ( MQCMDL_LEVEL_905 int32 = 905 MQCMDL_LEVEL_910 int32 = 910 MQCMDL_LEVEL_911 int32 = 911 + MQCMDL_LEVEL_912 int32 = 912 MQCMD_ACCOUNTING_MQI int32 = 167 MQCMD_ACCOUNTING_Q int32 = 168 MQCMD_ACTIVITY_MSG int32 = 69 @@ -1148,6 +1152,8 @@ var ( MQCMD_INQUIRE_TRACE int32 = 125 MQCMD_INQUIRE_USAGE int32 = 126 MQCMD_INQUIRE_XR_CAPABILITY int32 = 214 + MQCMD_INTER_Q_MGR_BALANCE int32 = 219 + MQCMD_INTER_Q_MGR_STATUS int32 = 218 MQCMD_LOGGER_EVENT int32 = 91 MQCMD_MOVE_Q int32 = 127 MQCMD_MQXR_DIAGNOSTICS int32 = 196 @@ -1226,8 +1232,8 @@ var ( MQCNO_ALL_CONVS_SHARE int32 = 262144 MQCNO_CD_FOR_OUTPUT_ONLY int32 = 524288 MQCNO_CLIENT_BINDING int32 = 2048 - MQCNO_CURRENT_LENGTH int32 = 224 - MQCNO_CURRENT_VERSION int32 = 6 + MQCNO_CURRENT_LENGTH int32 = 256 + MQCNO_CURRENT_VERSION int32 = 7 MQCNO_FASTPATH_BINDING int32 = 1 MQCNO_HANDLE_SHARE_BLOCK int32 = 64 MQCNO_HANDLE_SHARE_NONE int32 = 32 @@ -1239,6 +1245,7 @@ var ( MQCNO_LENGTH_4 int32 = 168 MQCNO_LENGTH_5 int32 = 200 MQCNO_LENGTH_6 int32 = 224 + MQCNO_LENGTH_7 int32 = 256 MQCNO_LOCAL_BINDING int32 = 1024 MQCNO_NONE int32 = 0 MQCNO_NO_CONV_SHARING int32 = 65536 @@ -1259,6 +1266,7 @@ var ( MQCNO_VERSION_4 int32 = 4 MQCNO_VERSION_5 int32 = 5 MQCNO_VERSION_6 int32 = 6 + MQCNO_VERSION_7 int32 = 7 MQCODL_AS_INPUT int32 = -1 MQCOMPRESS_ANY int32 = 268435455 MQCOMPRESS_NONE int32 = 0 @@ -1562,13 +1570,17 @@ var ( MQFUN_TYPE_USERDEF int32 = 4 MQGACF_ACTIVITY int32 = 8005 MQGACF_ACTIVITY_TRACE int32 = 8013 + MQGACF_ALL_APPLS int32 = 8020 + MQGACF_APPL_BALANCE int32 = 8021 + MQGACF_APPL_STATUS int32 = 8018 MQGACF_APP_DIST_LIST int32 = 8014 + MQGACF_CHANGED_APPLS int32 = 8019 MQGACF_CHL_STATISTICS_DATA int32 = 8012 MQGACF_COMMAND_CONTEXT int32 = 8001 MQGACF_COMMAND_DATA int32 = 8002 MQGACF_EMBEDDED_MQMD int32 = 8006 MQGACF_FIRST int32 = 8001 - MQGACF_LAST_USED int32 = 8017 + MQGACF_LAST_USED int32 = 8021 MQGACF_MESSAGE int32 = 8007 MQGACF_MONITOR_CLASS int32 = 8015 MQGACF_MONITOR_ELEMENT int32 = 8017 @@ -1751,7 +1763,7 @@ var ( MQIACF_INVALID_DEST_COUNT int32 = 1371 MQIACF_ITEM_COUNT int32 = 1378 MQIACF_KNOWN_DEST_COUNT int32 = 1369 - MQIACF_LAST_USED int32 = 1423 + MQIACF_LAST_USED int32 = 1424 MQIACF_LDAP_CONNECTION_STATUS int32 = 1409 MQIACF_LISTENER_ATTRS int32 = 1222 MQIACF_LISTENER_STATUS_ATTRS int32 = 1223 @@ -1765,6 +1777,7 @@ var ( MQIACF_MESSAGE_COUNT int32 = 1290 MQIACF_MODE int32 = 1008 MQIACF_MONITORING int32 = 1258 + MQIACF_MOVABLE_APPL_COUNT int32 = 1424 MQIACF_MOVE_COUNT int32 = 1171 MQIACF_MOVE_TYPE int32 = 1145 MQIACF_MOVE_TYPE_ADD int32 = 1147 @@ -3349,6 +3362,7 @@ var ( MQRCCF_PROGRAM_NOT_AVAILABLE int32 = 3176 MQRCCF_PSCLUS_DISABLED_TOPDEF int32 = 3359 MQRCCF_PSCLUS_TOPIC_EXISTS int32 = 3360 + MQRCCF_PS_REQUIRED_MQUC int32 = 3383 MQRCCF_PUBSUB_INHIBITED int32 = 3318 MQRCCF_PUB_OPTIONS_ERROR int32 = 3084 MQRCCF_PURGE_VALUE_ERROR int32 = 3046 @@ -3657,6 +3671,7 @@ var ( MQRC_IMPO_ERROR int32 = 2464 MQRC_INCOMPLETE_GROUP int32 = 2241 MQRC_INCOMPLETE_MSG int32 = 2242 + MQRC_INCOMPLETE_TRANSACTION int32 = 2147 MQRC_INCONSISTENT_BROWSE int32 = 2259 MQRC_INCONSISTENT_CCSIDS int32 = 2243 MQRC_INCONSISTENT_ENCODINGS int32 = 2244 diff --git a/ibmmq/cmqc_linux_amd64.go b/ibmmq/cmqc_linux_amd64.go index 8becc31..7ee6407 100644 --- a/ibmmq/cmqc_linux_amd64.go +++ b/ibmmq/cmqc_linux_amd64.go @@ -14,7 +14,7 @@ package ibmmq * for each value; those can be found in other header files such as * cmqc.h. **************************************************************** -* Copyright (c) IBM Corporation 1993, 2018 +* Copyright (c) IBM Corporation 1993, 2019 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,8 @@ package ibmmq **************************************************************** * * -* Generated on: 112018 5:02 PM -* Build Level: p911-L181120.1 +* Generated on: 3/8/19 4:14 PM +* Build Level: p912-L190308 * Build Type: Production * */ @@ -194,7 +194,7 @@ var ( MQBACF_FIRST int32 = 7001 MQBACF_GENERIC_CONNECTION_ID int32 = 7007 MQBACF_GROUP_ID int32 = 7012 - MQBACF_LAST_USED int32 = 7035 + MQBACF_LAST_USED int32 = 7037 MQBACF_MESSAGE_DATA int32 = 7020 MQBACF_MQBO_STRUCT int32 = 7021 MQBACF_MQCBC_STRUCT int32 = 7023 @@ -209,7 +209,9 @@ var ( MQBACF_MQSTS_STRUCT int32 = 7031 MQBACF_MSG_ID int32 = 7013 MQBACF_ORIGIN_UOW_ID int32 = 7008 + MQBACF_PROPERTIES_DATA int32 = 7037 MQBACF_Q_MGR_UOW_ID int32 = 7009 + MQBACF_REQUEST_ID int32 = 7036 MQBACF_RESPONSE_ID int32 = 7004 MQBACF_RESPONSE_SET int32 = 7003 MQBACF_SUB_CORREL_ID int32 = 7032 @@ -851,6 +853,7 @@ var ( MQCFT_REPORT int32 = 12 MQCFT_RESPONSE int32 = 2 MQCFT_STATISTICS int32 = 21 + MQCFT_STATUS int32 = 27 MQCFT_STRING int32 = 4 MQCFT_STRING_FILTER int32 = 14 MQCFT_STRING_LIST int32 = 6 @@ -979,7 +982,7 @@ var ( MQCMDI_SEC_SIGNOFF_ERROR int32 = 17 MQCMDI_SEC_TIMER_ZERO int32 = 14 MQCMDI_SEC_UPPERCASE int32 = 21 - MQCMDL_CURRENT_LEVEL int32 = 911 + MQCMDL_CURRENT_LEVEL int32 = 912 MQCMDL_LEVEL_1 int32 = 100 MQCMDL_LEVEL_101 int32 = 101 MQCMDL_LEVEL_110 int32 = 110 @@ -1016,6 +1019,7 @@ var ( MQCMDL_LEVEL_905 int32 = 905 MQCMDL_LEVEL_910 int32 = 910 MQCMDL_LEVEL_911 int32 = 911 + MQCMDL_LEVEL_912 int32 = 912 MQCMD_ACCOUNTING_MQI int32 = 167 MQCMD_ACCOUNTING_Q int32 = 168 MQCMD_ACTIVITY_MSG int32 = 69 @@ -1148,6 +1152,8 @@ var ( MQCMD_INQUIRE_TRACE int32 = 125 MQCMD_INQUIRE_USAGE int32 = 126 MQCMD_INQUIRE_XR_CAPABILITY int32 = 214 + MQCMD_INTER_Q_MGR_BALANCE int32 = 219 + MQCMD_INTER_Q_MGR_STATUS int32 = 218 MQCMD_LOGGER_EVENT int32 = 91 MQCMD_MOVE_Q int32 = 127 MQCMD_MQXR_DIAGNOSTICS int32 = 196 @@ -1226,8 +1232,8 @@ var ( MQCNO_ALL_CONVS_SHARE int32 = 262144 MQCNO_CD_FOR_OUTPUT_ONLY int32 = 524288 MQCNO_CLIENT_BINDING int32 = 2048 - MQCNO_CURRENT_LENGTH int32 = 224 - MQCNO_CURRENT_VERSION int32 = 6 + MQCNO_CURRENT_LENGTH int32 = 256 + MQCNO_CURRENT_VERSION int32 = 7 MQCNO_FASTPATH_BINDING int32 = 1 MQCNO_HANDLE_SHARE_BLOCK int32 = 64 MQCNO_HANDLE_SHARE_NONE int32 = 32 @@ -1239,6 +1245,7 @@ var ( MQCNO_LENGTH_4 int32 = 168 MQCNO_LENGTH_5 int32 = 200 MQCNO_LENGTH_6 int32 = 224 + MQCNO_LENGTH_7 int32 = 256 MQCNO_LOCAL_BINDING int32 = 1024 MQCNO_NONE int32 = 0 MQCNO_NO_CONV_SHARING int32 = 65536 @@ -1259,6 +1266,7 @@ var ( MQCNO_VERSION_4 int32 = 4 MQCNO_VERSION_5 int32 = 5 MQCNO_VERSION_6 int32 = 6 + MQCNO_VERSION_7 int32 = 7 MQCODL_AS_INPUT int32 = -1 MQCOMPRESS_ANY int32 = 268435455 MQCOMPRESS_NONE int32 = 0 @@ -1562,13 +1570,17 @@ var ( MQFUN_TYPE_USERDEF int32 = 4 MQGACF_ACTIVITY int32 = 8005 MQGACF_ACTIVITY_TRACE int32 = 8013 + MQGACF_ALL_APPLS int32 = 8020 + MQGACF_APPL_BALANCE int32 = 8021 + MQGACF_APPL_STATUS int32 = 8018 MQGACF_APP_DIST_LIST int32 = 8014 + MQGACF_CHANGED_APPLS int32 = 8019 MQGACF_CHL_STATISTICS_DATA int32 = 8012 MQGACF_COMMAND_CONTEXT int32 = 8001 MQGACF_COMMAND_DATA int32 = 8002 MQGACF_EMBEDDED_MQMD int32 = 8006 MQGACF_FIRST int32 = 8001 - MQGACF_LAST_USED int32 = 8017 + MQGACF_LAST_USED int32 = 8021 MQGACF_MESSAGE int32 = 8007 MQGACF_MONITOR_CLASS int32 = 8015 MQGACF_MONITOR_ELEMENT int32 = 8017 @@ -1751,7 +1763,7 @@ var ( MQIACF_INVALID_DEST_COUNT int32 = 1371 MQIACF_ITEM_COUNT int32 = 1378 MQIACF_KNOWN_DEST_COUNT int32 = 1369 - MQIACF_LAST_USED int32 = 1423 + MQIACF_LAST_USED int32 = 1424 MQIACF_LDAP_CONNECTION_STATUS int32 = 1409 MQIACF_LISTENER_ATTRS int32 = 1222 MQIACF_LISTENER_STATUS_ATTRS int32 = 1223 @@ -1765,6 +1777,7 @@ var ( MQIACF_MESSAGE_COUNT int32 = 1290 MQIACF_MODE int32 = 1008 MQIACF_MONITORING int32 = 1258 + MQIACF_MOVABLE_APPL_COUNT int32 = 1424 MQIACF_MOVE_COUNT int32 = 1171 MQIACF_MOVE_TYPE int32 = 1145 MQIACF_MOVE_TYPE_ADD int32 = 1147 @@ -3349,6 +3362,7 @@ var ( MQRCCF_PROGRAM_NOT_AVAILABLE int32 = 3176 MQRCCF_PSCLUS_DISABLED_TOPDEF int32 = 3359 MQRCCF_PSCLUS_TOPIC_EXISTS int32 = 3360 + MQRCCF_PS_REQUIRED_MQUC int32 = 3383 MQRCCF_PUBSUB_INHIBITED int32 = 3318 MQRCCF_PUB_OPTIONS_ERROR int32 = 3084 MQRCCF_PURGE_VALUE_ERROR int32 = 3046 @@ -3657,6 +3671,7 @@ var ( MQRC_IMPO_ERROR int32 = 2464 MQRC_INCOMPLETE_GROUP int32 = 2241 MQRC_INCOMPLETE_MSG int32 = 2242 + MQRC_INCOMPLETE_TRANSACTION int32 = 2147 MQRC_INCONSISTENT_BROWSE int32 = 2259 MQRC_INCONSISTENT_CCSIDS int32 = 2243 MQRC_INCONSISTENT_ENCODINGS int32 = 2244 diff --git a/ibmmq/cmqc_linux_ppc64le.go b/ibmmq/cmqc_linux_ppc64le.go index 6ac1b90..b7b0dfe 100644 --- a/ibmmq/cmqc_linux_ppc64le.go +++ b/ibmmq/cmqc_linux_ppc64le.go @@ -14,7 +14,7 @@ package ibmmq * for each value; those can be found in other header files such as * cmqc.h. **************************************************************** -* Copyright (c) IBM Corporation 1993, 2018 +* Copyright (c) IBM Corporation 1993, 2019 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,8 @@ package ibmmq **************************************************************** * * -* Generated on: 112018 5:02 PM -* Build Level: p911-L181120.1 +* Generated on: 3/8/19 4:14 PM +* Build Level: p912-L190308 * Build Type: Production * */ @@ -194,7 +194,7 @@ var ( MQBACF_FIRST int32 = 7001 MQBACF_GENERIC_CONNECTION_ID int32 = 7007 MQBACF_GROUP_ID int32 = 7012 - MQBACF_LAST_USED int32 = 7035 + MQBACF_LAST_USED int32 = 7037 MQBACF_MESSAGE_DATA int32 = 7020 MQBACF_MQBO_STRUCT int32 = 7021 MQBACF_MQCBC_STRUCT int32 = 7023 @@ -209,7 +209,9 @@ var ( MQBACF_MQSTS_STRUCT int32 = 7031 MQBACF_MSG_ID int32 = 7013 MQBACF_ORIGIN_UOW_ID int32 = 7008 + MQBACF_PROPERTIES_DATA int32 = 7037 MQBACF_Q_MGR_UOW_ID int32 = 7009 + MQBACF_REQUEST_ID int32 = 7036 MQBACF_RESPONSE_ID int32 = 7004 MQBACF_RESPONSE_SET int32 = 7003 MQBACF_SUB_CORREL_ID int32 = 7032 @@ -851,6 +853,7 @@ var ( MQCFT_REPORT int32 = 12 MQCFT_RESPONSE int32 = 2 MQCFT_STATISTICS int32 = 21 + MQCFT_STATUS int32 = 27 MQCFT_STRING int32 = 4 MQCFT_STRING_FILTER int32 = 14 MQCFT_STRING_LIST int32 = 6 @@ -979,7 +982,7 @@ var ( MQCMDI_SEC_SIGNOFF_ERROR int32 = 17 MQCMDI_SEC_TIMER_ZERO int32 = 14 MQCMDI_SEC_UPPERCASE int32 = 21 - MQCMDL_CURRENT_LEVEL int32 = 911 + MQCMDL_CURRENT_LEVEL int32 = 912 MQCMDL_LEVEL_1 int32 = 100 MQCMDL_LEVEL_101 int32 = 101 MQCMDL_LEVEL_110 int32 = 110 @@ -1016,6 +1019,7 @@ var ( MQCMDL_LEVEL_905 int32 = 905 MQCMDL_LEVEL_910 int32 = 910 MQCMDL_LEVEL_911 int32 = 911 + MQCMDL_LEVEL_912 int32 = 912 MQCMD_ACCOUNTING_MQI int32 = 167 MQCMD_ACCOUNTING_Q int32 = 168 MQCMD_ACTIVITY_MSG int32 = 69 @@ -1148,6 +1152,8 @@ var ( MQCMD_INQUIRE_TRACE int32 = 125 MQCMD_INQUIRE_USAGE int32 = 126 MQCMD_INQUIRE_XR_CAPABILITY int32 = 214 + MQCMD_INTER_Q_MGR_BALANCE int32 = 219 + MQCMD_INTER_Q_MGR_STATUS int32 = 218 MQCMD_LOGGER_EVENT int32 = 91 MQCMD_MOVE_Q int32 = 127 MQCMD_MQXR_DIAGNOSTICS int32 = 196 @@ -1226,8 +1232,8 @@ var ( MQCNO_ALL_CONVS_SHARE int32 = 262144 MQCNO_CD_FOR_OUTPUT_ONLY int32 = 524288 MQCNO_CLIENT_BINDING int32 = 2048 - MQCNO_CURRENT_LENGTH int32 = 224 - MQCNO_CURRENT_VERSION int32 = 6 + MQCNO_CURRENT_LENGTH int32 = 256 + MQCNO_CURRENT_VERSION int32 = 7 MQCNO_FASTPATH_BINDING int32 = 1 MQCNO_HANDLE_SHARE_BLOCK int32 = 64 MQCNO_HANDLE_SHARE_NONE int32 = 32 @@ -1239,6 +1245,7 @@ var ( MQCNO_LENGTH_4 int32 = 168 MQCNO_LENGTH_5 int32 = 200 MQCNO_LENGTH_6 int32 = 224 + MQCNO_LENGTH_7 int32 = 256 MQCNO_LOCAL_BINDING int32 = 1024 MQCNO_NONE int32 = 0 MQCNO_NO_CONV_SHARING int32 = 65536 @@ -1259,6 +1266,7 @@ var ( MQCNO_VERSION_4 int32 = 4 MQCNO_VERSION_5 int32 = 5 MQCNO_VERSION_6 int32 = 6 + MQCNO_VERSION_7 int32 = 7 MQCODL_AS_INPUT int32 = -1 MQCOMPRESS_ANY int32 = 268435455 MQCOMPRESS_NONE int32 = 0 @@ -1562,13 +1570,17 @@ var ( MQFUN_TYPE_USERDEF int32 = 4 MQGACF_ACTIVITY int32 = 8005 MQGACF_ACTIVITY_TRACE int32 = 8013 + MQGACF_ALL_APPLS int32 = 8020 + MQGACF_APPL_BALANCE int32 = 8021 + MQGACF_APPL_STATUS int32 = 8018 MQGACF_APP_DIST_LIST int32 = 8014 + MQGACF_CHANGED_APPLS int32 = 8019 MQGACF_CHL_STATISTICS_DATA int32 = 8012 MQGACF_COMMAND_CONTEXT int32 = 8001 MQGACF_COMMAND_DATA int32 = 8002 MQGACF_EMBEDDED_MQMD int32 = 8006 MQGACF_FIRST int32 = 8001 - MQGACF_LAST_USED int32 = 8017 + MQGACF_LAST_USED int32 = 8021 MQGACF_MESSAGE int32 = 8007 MQGACF_MONITOR_CLASS int32 = 8015 MQGACF_MONITOR_ELEMENT int32 = 8017 @@ -1751,7 +1763,7 @@ var ( MQIACF_INVALID_DEST_COUNT int32 = 1371 MQIACF_ITEM_COUNT int32 = 1378 MQIACF_KNOWN_DEST_COUNT int32 = 1369 - MQIACF_LAST_USED int32 = 1423 + MQIACF_LAST_USED int32 = 1424 MQIACF_LDAP_CONNECTION_STATUS int32 = 1409 MQIACF_LISTENER_ATTRS int32 = 1222 MQIACF_LISTENER_STATUS_ATTRS int32 = 1223 @@ -1765,6 +1777,7 @@ var ( MQIACF_MESSAGE_COUNT int32 = 1290 MQIACF_MODE int32 = 1008 MQIACF_MONITORING int32 = 1258 + MQIACF_MOVABLE_APPL_COUNT int32 = 1424 MQIACF_MOVE_COUNT int32 = 1171 MQIACF_MOVE_TYPE int32 = 1145 MQIACF_MOVE_TYPE_ADD int32 = 1147 @@ -3349,6 +3362,7 @@ var ( MQRCCF_PROGRAM_NOT_AVAILABLE int32 = 3176 MQRCCF_PSCLUS_DISABLED_TOPDEF int32 = 3359 MQRCCF_PSCLUS_TOPIC_EXISTS int32 = 3360 + MQRCCF_PS_REQUIRED_MQUC int32 = 3383 MQRCCF_PUBSUB_INHIBITED int32 = 3318 MQRCCF_PUB_OPTIONS_ERROR int32 = 3084 MQRCCF_PURGE_VALUE_ERROR int32 = 3046 @@ -3657,6 +3671,7 @@ var ( MQRC_IMPO_ERROR int32 = 2464 MQRC_INCOMPLETE_GROUP int32 = 2241 MQRC_INCOMPLETE_MSG int32 = 2242 + MQRC_INCOMPLETE_TRANSACTION int32 = 2147 MQRC_INCONSISTENT_BROWSE int32 = 2259 MQRC_INCONSISTENT_CCSIDS int32 = 2243 MQRC_INCONSISTENT_ENCODINGS int32 = 2244 diff --git a/ibmmq/cmqc_linux_s390x.go b/ibmmq/cmqc_linux_s390x.go index 5e36cbf..985e0b6 100644 --- a/ibmmq/cmqc_linux_s390x.go +++ b/ibmmq/cmqc_linux_s390x.go @@ -14,7 +14,7 @@ package ibmmq * for each value; those can be found in other header files such as * cmqc.h. **************************************************************** -* Copyright (c) IBM Corporation 1993, 2018 +* Copyright (c) IBM Corporation 1993, 2019 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,8 @@ package ibmmq **************************************************************** * * -* Generated on: 112018 5:02 PM -* Build Level: p911-L181120.1 +* Generated on: 3/8/19 4:14 PM +* Build Level: p912-L190308 * Build Type: Production * */ @@ -194,7 +194,7 @@ var ( MQBACF_FIRST int32 = 7001 MQBACF_GENERIC_CONNECTION_ID int32 = 7007 MQBACF_GROUP_ID int32 = 7012 - MQBACF_LAST_USED int32 = 7035 + MQBACF_LAST_USED int32 = 7037 MQBACF_MESSAGE_DATA int32 = 7020 MQBACF_MQBO_STRUCT int32 = 7021 MQBACF_MQCBC_STRUCT int32 = 7023 @@ -209,7 +209,9 @@ var ( MQBACF_MQSTS_STRUCT int32 = 7031 MQBACF_MSG_ID int32 = 7013 MQBACF_ORIGIN_UOW_ID int32 = 7008 + MQBACF_PROPERTIES_DATA int32 = 7037 MQBACF_Q_MGR_UOW_ID int32 = 7009 + MQBACF_REQUEST_ID int32 = 7036 MQBACF_RESPONSE_ID int32 = 7004 MQBACF_RESPONSE_SET int32 = 7003 MQBACF_SUB_CORREL_ID int32 = 7032 @@ -851,6 +853,7 @@ var ( MQCFT_REPORT int32 = 12 MQCFT_RESPONSE int32 = 2 MQCFT_STATISTICS int32 = 21 + MQCFT_STATUS int32 = 27 MQCFT_STRING int32 = 4 MQCFT_STRING_FILTER int32 = 14 MQCFT_STRING_LIST int32 = 6 @@ -979,7 +982,7 @@ var ( MQCMDI_SEC_SIGNOFF_ERROR int32 = 17 MQCMDI_SEC_TIMER_ZERO int32 = 14 MQCMDI_SEC_UPPERCASE int32 = 21 - MQCMDL_CURRENT_LEVEL int32 = 911 + MQCMDL_CURRENT_LEVEL int32 = 912 MQCMDL_LEVEL_1 int32 = 100 MQCMDL_LEVEL_101 int32 = 101 MQCMDL_LEVEL_110 int32 = 110 @@ -1016,6 +1019,7 @@ var ( MQCMDL_LEVEL_905 int32 = 905 MQCMDL_LEVEL_910 int32 = 910 MQCMDL_LEVEL_911 int32 = 911 + MQCMDL_LEVEL_912 int32 = 912 MQCMD_ACCOUNTING_MQI int32 = 167 MQCMD_ACCOUNTING_Q int32 = 168 MQCMD_ACTIVITY_MSG int32 = 69 @@ -1148,6 +1152,8 @@ var ( MQCMD_INQUIRE_TRACE int32 = 125 MQCMD_INQUIRE_USAGE int32 = 126 MQCMD_INQUIRE_XR_CAPABILITY int32 = 214 + MQCMD_INTER_Q_MGR_BALANCE int32 = 219 + MQCMD_INTER_Q_MGR_STATUS int32 = 218 MQCMD_LOGGER_EVENT int32 = 91 MQCMD_MOVE_Q int32 = 127 MQCMD_MQXR_DIAGNOSTICS int32 = 196 @@ -1226,8 +1232,8 @@ var ( MQCNO_ALL_CONVS_SHARE int32 = 262144 MQCNO_CD_FOR_OUTPUT_ONLY int32 = 524288 MQCNO_CLIENT_BINDING int32 = 2048 - MQCNO_CURRENT_LENGTH int32 = 224 - MQCNO_CURRENT_VERSION int32 = 6 + MQCNO_CURRENT_LENGTH int32 = 256 + MQCNO_CURRENT_VERSION int32 = 7 MQCNO_FASTPATH_BINDING int32 = 1 MQCNO_HANDLE_SHARE_BLOCK int32 = 64 MQCNO_HANDLE_SHARE_NONE int32 = 32 @@ -1239,6 +1245,7 @@ var ( MQCNO_LENGTH_4 int32 = 168 MQCNO_LENGTH_5 int32 = 200 MQCNO_LENGTH_6 int32 = 224 + MQCNO_LENGTH_7 int32 = 256 MQCNO_LOCAL_BINDING int32 = 1024 MQCNO_NONE int32 = 0 MQCNO_NO_CONV_SHARING int32 = 65536 @@ -1259,6 +1266,7 @@ var ( MQCNO_VERSION_4 int32 = 4 MQCNO_VERSION_5 int32 = 5 MQCNO_VERSION_6 int32 = 6 + MQCNO_VERSION_7 int32 = 7 MQCODL_AS_INPUT int32 = -1 MQCOMPRESS_ANY int32 = 268435455 MQCOMPRESS_NONE int32 = 0 @@ -1562,13 +1570,17 @@ var ( MQFUN_TYPE_USERDEF int32 = 4 MQGACF_ACTIVITY int32 = 8005 MQGACF_ACTIVITY_TRACE int32 = 8013 + MQGACF_ALL_APPLS int32 = 8020 + MQGACF_APPL_BALANCE int32 = 8021 + MQGACF_APPL_STATUS int32 = 8018 MQGACF_APP_DIST_LIST int32 = 8014 + MQGACF_CHANGED_APPLS int32 = 8019 MQGACF_CHL_STATISTICS_DATA int32 = 8012 MQGACF_COMMAND_CONTEXT int32 = 8001 MQGACF_COMMAND_DATA int32 = 8002 MQGACF_EMBEDDED_MQMD int32 = 8006 MQGACF_FIRST int32 = 8001 - MQGACF_LAST_USED int32 = 8017 + MQGACF_LAST_USED int32 = 8021 MQGACF_MESSAGE int32 = 8007 MQGACF_MONITOR_CLASS int32 = 8015 MQGACF_MONITOR_ELEMENT int32 = 8017 @@ -1751,7 +1763,7 @@ var ( MQIACF_INVALID_DEST_COUNT int32 = 1371 MQIACF_ITEM_COUNT int32 = 1378 MQIACF_KNOWN_DEST_COUNT int32 = 1369 - MQIACF_LAST_USED int32 = 1423 + MQIACF_LAST_USED int32 = 1424 MQIACF_LDAP_CONNECTION_STATUS int32 = 1409 MQIACF_LISTENER_ATTRS int32 = 1222 MQIACF_LISTENER_STATUS_ATTRS int32 = 1223 @@ -1765,6 +1777,7 @@ var ( MQIACF_MESSAGE_COUNT int32 = 1290 MQIACF_MODE int32 = 1008 MQIACF_MONITORING int32 = 1258 + MQIACF_MOVABLE_APPL_COUNT int32 = 1424 MQIACF_MOVE_COUNT int32 = 1171 MQIACF_MOVE_TYPE int32 = 1145 MQIACF_MOVE_TYPE_ADD int32 = 1147 @@ -3349,6 +3362,7 @@ var ( MQRCCF_PROGRAM_NOT_AVAILABLE int32 = 3176 MQRCCF_PSCLUS_DISABLED_TOPDEF int32 = 3359 MQRCCF_PSCLUS_TOPIC_EXISTS int32 = 3360 + MQRCCF_PS_REQUIRED_MQUC int32 = 3383 MQRCCF_PUBSUB_INHIBITED int32 = 3318 MQRCCF_PUB_OPTIONS_ERROR int32 = 3084 MQRCCF_PURGE_VALUE_ERROR int32 = 3046 @@ -3657,6 +3671,7 @@ var ( MQRC_IMPO_ERROR int32 = 2464 MQRC_INCOMPLETE_GROUP int32 = 2241 MQRC_INCOMPLETE_MSG int32 = 2242 + MQRC_INCOMPLETE_TRANSACTION int32 = 2147 MQRC_INCONSISTENT_BROWSE int32 = 2259 MQRC_INCONSISTENT_CCSIDS int32 = 2243 MQRC_INCONSISTENT_ENCODINGS int32 = 2244 diff --git a/ibmmq/cmqc_windows.go b/ibmmq/cmqc_windows.go index 9d13bf2..4eb6b26 100644 --- a/ibmmq/cmqc_windows.go +++ b/ibmmq/cmqc_windows.go @@ -14,7 +14,7 @@ package ibmmq * for each value; those can be found in other header files such as * cmqc.h. **************************************************************** -* Copyright (c) IBM Corporation 1993, 2018 +* Copyright (c) IBM Corporation 1993, 2019 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,8 @@ package ibmmq **************************************************************** * * -* Generated on: 112018 5:02 PM -* Build Level: p911-L181120.1 +* Generated on: 3/8/19 4:14 PM +* Build Level: p912-L190308 * Build Type: Production * */ @@ -194,7 +194,7 @@ var ( MQBACF_FIRST int32 = 7001 MQBACF_GENERIC_CONNECTION_ID int32 = 7007 MQBACF_GROUP_ID int32 = 7012 - MQBACF_LAST_USED int32 = 7035 + MQBACF_LAST_USED int32 = 7037 MQBACF_MESSAGE_DATA int32 = 7020 MQBACF_MQBO_STRUCT int32 = 7021 MQBACF_MQCBC_STRUCT int32 = 7023 @@ -209,7 +209,9 @@ var ( MQBACF_MQSTS_STRUCT int32 = 7031 MQBACF_MSG_ID int32 = 7013 MQBACF_ORIGIN_UOW_ID int32 = 7008 + MQBACF_PROPERTIES_DATA int32 = 7037 MQBACF_Q_MGR_UOW_ID int32 = 7009 + MQBACF_REQUEST_ID int32 = 7036 MQBACF_RESPONSE_ID int32 = 7004 MQBACF_RESPONSE_SET int32 = 7003 MQBACF_SUB_CORREL_ID int32 = 7032 @@ -851,6 +853,7 @@ var ( MQCFT_REPORT int32 = 12 MQCFT_RESPONSE int32 = 2 MQCFT_STATISTICS int32 = 21 + MQCFT_STATUS int32 = 27 MQCFT_STRING int32 = 4 MQCFT_STRING_FILTER int32 = 14 MQCFT_STRING_LIST int32 = 6 @@ -979,7 +982,7 @@ var ( MQCMDI_SEC_SIGNOFF_ERROR int32 = 17 MQCMDI_SEC_TIMER_ZERO int32 = 14 MQCMDI_SEC_UPPERCASE int32 = 21 - MQCMDL_CURRENT_LEVEL int32 = 911 + MQCMDL_CURRENT_LEVEL int32 = 912 MQCMDL_LEVEL_1 int32 = 100 MQCMDL_LEVEL_101 int32 = 101 MQCMDL_LEVEL_110 int32 = 110 @@ -1016,6 +1019,7 @@ var ( MQCMDL_LEVEL_905 int32 = 905 MQCMDL_LEVEL_910 int32 = 910 MQCMDL_LEVEL_911 int32 = 911 + MQCMDL_LEVEL_912 int32 = 912 MQCMD_ACCOUNTING_MQI int32 = 167 MQCMD_ACCOUNTING_Q int32 = 168 MQCMD_ACTIVITY_MSG int32 = 69 @@ -1148,6 +1152,8 @@ var ( MQCMD_INQUIRE_TRACE int32 = 125 MQCMD_INQUIRE_USAGE int32 = 126 MQCMD_INQUIRE_XR_CAPABILITY int32 = 214 + MQCMD_INTER_Q_MGR_BALANCE int32 = 219 + MQCMD_INTER_Q_MGR_STATUS int32 = 218 MQCMD_LOGGER_EVENT int32 = 91 MQCMD_MOVE_Q int32 = 127 MQCMD_MQXR_DIAGNOSTICS int32 = 196 @@ -1226,8 +1232,8 @@ var ( MQCNO_ALL_CONVS_SHARE int32 = 262144 MQCNO_CD_FOR_OUTPUT_ONLY int32 = 524288 MQCNO_CLIENT_BINDING int32 = 2048 - MQCNO_CURRENT_LENGTH int32 = 224 - MQCNO_CURRENT_VERSION int32 = 6 + MQCNO_CURRENT_LENGTH int32 = 256 + MQCNO_CURRENT_VERSION int32 = 7 MQCNO_FASTPATH_BINDING int32 = 1 MQCNO_HANDLE_SHARE_BLOCK int32 = 64 MQCNO_HANDLE_SHARE_NONE int32 = 32 @@ -1239,6 +1245,7 @@ var ( MQCNO_LENGTH_4 int32 = 168 MQCNO_LENGTH_5 int32 = 200 MQCNO_LENGTH_6 int32 = 224 + MQCNO_LENGTH_7 int32 = 256 MQCNO_LOCAL_BINDING int32 = 1024 MQCNO_NONE int32 = 0 MQCNO_NO_CONV_SHARING int32 = 65536 @@ -1259,6 +1266,7 @@ var ( MQCNO_VERSION_4 int32 = 4 MQCNO_VERSION_5 int32 = 5 MQCNO_VERSION_6 int32 = 6 + MQCNO_VERSION_7 int32 = 7 MQCODL_AS_INPUT int32 = -1 MQCOMPRESS_ANY int32 = 268435455 MQCOMPRESS_NONE int32 = 0 @@ -1562,13 +1570,17 @@ var ( MQFUN_TYPE_USERDEF int32 = 4 MQGACF_ACTIVITY int32 = 8005 MQGACF_ACTIVITY_TRACE int32 = 8013 + MQGACF_ALL_APPLS int32 = 8020 + MQGACF_APPL_BALANCE int32 = 8021 + MQGACF_APPL_STATUS int32 = 8018 MQGACF_APP_DIST_LIST int32 = 8014 + MQGACF_CHANGED_APPLS int32 = 8019 MQGACF_CHL_STATISTICS_DATA int32 = 8012 MQGACF_COMMAND_CONTEXT int32 = 8001 MQGACF_COMMAND_DATA int32 = 8002 MQGACF_EMBEDDED_MQMD int32 = 8006 MQGACF_FIRST int32 = 8001 - MQGACF_LAST_USED int32 = 8017 + MQGACF_LAST_USED int32 = 8021 MQGACF_MESSAGE int32 = 8007 MQGACF_MONITOR_CLASS int32 = 8015 MQGACF_MONITOR_ELEMENT int32 = 8017 @@ -1751,7 +1763,7 @@ var ( MQIACF_INVALID_DEST_COUNT int32 = 1371 MQIACF_ITEM_COUNT int32 = 1378 MQIACF_KNOWN_DEST_COUNT int32 = 1369 - MQIACF_LAST_USED int32 = 1423 + MQIACF_LAST_USED int32 = 1424 MQIACF_LDAP_CONNECTION_STATUS int32 = 1409 MQIACF_LISTENER_ATTRS int32 = 1222 MQIACF_LISTENER_STATUS_ATTRS int32 = 1223 @@ -1765,6 +1777,7 @@ var ( MQIACF_MESSAGE_COUNT int32 = 1290 MQIACF_MODE int32 = 1008 MQIACF_MONITORING int32 = 1258 + MQIACF_MOVABLE_APPL_COUNT int32 = 1424 MQIACF_MOVE_COUNT int32 = 1171 MQIACF_MOVE_TYPE int32 = 1145 MQIACF_MOVE_TYPE_ADD int32 = 1147 @@ -3349,6 +3362,7 @@ var ( MQRCCF_PROGRAM_NOT_AVAILABLE int32 = 3176 MQRCCF_PSCLUS_DISABLED_TOPDEF int32 = 3359 MQRCCF_PSCLUS_TOPIC_EXISTS int32 = 3360 + MQRCCF_PS_REQUIRED_MQUC int32 = 3383 MQRCCF_PUBSUB_INHIBITED int32 = 3318 MQRCCF_PUB_OPTIONS_ERROR int32 = 3084 MQRCCF_PURGE_VALUE_ERROR int32 = 3046 @@ -3657,6 +3671,7 @@ var ( MQRC_IMPO_ERROR int32 = 2464 MQRC_INCOMPLETE_GROUP int32 = 2241 MQRC_INCOMPLETE_MSG int32 = 2242 + MQRC_INCOMPLETE_TRANSACTION int32 = 2147 MQRC_INCONSISTENT_BROWSE int32 = 2259 MQRC_INCONSISTENT_CCSIDS int32 = 2243 MQRC_INCONSISTENT_ENCODINGS int32 = 2244 diff --git a/ibmmq/mqi.go b/ibmmq/mqi.go index 6af7230..ba3f54f 100644 --- a/ibmmq/mqi.go +++ b/ibmmq/mqi.go @@ -22,7 +22,7 @@ directories. package ibmmq /* - Copyright (c) IBM Corporation 2016, 2018 + Copyright (c) IBM Corporation 2016, 2019 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -178,6 +178,7 @@ func Connx(goQMgrName string, gocno *MQCNO) (MQQueueManager, error) { } qMgr := MQQueueManager{} + qMgr.Name = goQMgrName mqQMgrName := unsafe.Pointer(C.CString(goQMgrName)) defer C.free(mqQMgrName) @@ -211,8 +212,6 @@ func Connx(goQMgrName string, gocno *MQCNO) (MQQueueManager, error) { return qMgr, mqreturn } - qMgr.Name = goQMgrName - return qMgr, nil } @@ -636,10 +635,11 @@ how long each field in that buffer will be. The caller passes in how many integer selectors are expected to be returned, as well as the maximum length of the char buffer to be returned -Deprecated: This function is a direct mapping of the MQI C function. It should be considered -deprecated. In preference, use the InqMap function which provides a more convenient -API. In a future version of this package, Inq will be replaced by InqMap -*/ +This function is a direct mapping of the MQI C function. It has +now been removed (just commented-out to start with). It was originally +marked as deprecated but a new major version of the package has been created +to allow it to be completely replaced. + func (object MQObject) Inq(goSelectors []int32, intAttrCount int, charAttrLen int) ([]int32, []byte, error) { var mqrc C.MQLONG @@ -687,17 +687,18 @@ func (object MQObject) Inq(goSelectors []int32, intAttrCount int, charAttrLen in return goIntAttrs, goCharAttrs, nil } +*/ /* - * InqMap should be considered the replacement for the Inq() function as it - * has a much simpler API. Simply pass in the list of selectors for the object + * Inq is the function to inquire on an attribute of an object + * + * This has a much simpler API than the original implementation. + * Simply pass in the list of selectors for the object * and the return value consists of a map whose elements are * a) accessed via the selector * b) varying datatype (integer, string, string array) based on the selector - * In a future breaking update, this function will become the default Inq() - * implementation. */ -func (object MQObject) InqMap(goSelectors []int32) (map[int32]interface{}, error) { +func (object MQObject) Inq(goSelectors []int32) (map[int32]interface{}, error) { var mqrc C.MQLONG var mqcc C.MQLONG var mqCharAttrs C.PMQCHAR @@ -805,6 +806,14 @@ func (object MQObject) InqMap(goSelectors []int32) (map[int32]interface{}, error return returnedMap, nil } +/* +* The InqMap function was the migration path when the original Inq was +* deprecated. It is kept here as a tempoary wrapper to the new Inq() version. + */ +func (object MQObject) InqMap(goSelectors []int32) (map[int32]interface{}, error) { + return object.Inq(goSelectors) +} + /* * Set is the function that wraps MQSET. The single parameter is a map whose * elements contain an MQIA/MQCA selector with either a string or an int32 for @@ -1232,8 +1241,8 @@ func (handle *MQMessageHandle) InqMP(goimpo *MQIMPO, gopd *MQPD, name string) (s p := (*C.MQBYTE)(propertyPtr) propertyValue = (int16)(*p) case C.MQTYPE_INT32: - p := (*C.MQINT16)(propertyPtr) - propertyValue = (int16)(*p) + p := (*C.MQINT32)(propertyPtr) + propertyValue = (int32)(*p) case C.MQTYPE_INT64: p := (*C.MQINT64)(propertyPtr) propertyValue = (int64)(*p) diff --git a/ibmmq/mqiMQCNO.go b/ibmmq/mqiMQCNO.go index 44ee8d5..a5c80a9 100644 --- a/ibmmq/mqiMQCNO.go +++ b/ibmmq/mqiMQCNO.go @@ -1,7 +1,7 @@ package ibmmq /* - Copyright (c) IBM Corporation 2016,2018 + Copyright (c) IBM Corporation 2016,2019 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,12 @@ package ibmmq Mark Taylor - Initial Contribution */ +/* +C functions allow support of new features while still compiling +on older versions of the MQ header files. It uses the _VERSION values +to select what can be done. +*/ + /* #include @@ -52,6 +58,23 @@ void setCCDTUrl(MQCNO *mqcno, PMQCHAR url, MQLONG length) { #endif } + +void setCnoApplName(MQCNO *mqcno, PMQCHAR applName, MQLONG length) { +#if defined(MQCNO_VERSION_7) && MQCNO_CURRENT_VERSION >= MQCNO_VERSION_7 + if (applName != NULL) { + memset(mqcno->ApplName,0,length); + strncpy(mqcno->ApplName,applName,length); + if (mqcno->Version < MQCNO_VERSION_7) { + mqcno->Version = MQCNO_VERSION_7; + } + } +#endif + if (applName != NULL) { + free(applName); + } + return; +} + */ import "C" import "unsafe" @@ -68,6 +91,7 @@ type MQCNO struct { CCDTUrl string ClientConn *MQCD SSLConfig *MQSCO + ApplName string } /* @@ -89,6 +113,8 @@ func NewMQCNO() *MQCNO { cno.Options = int32(C.MQCNO_NONE) cno.SecurityParms = nil cno.ClientConn = nil + cno.CCDTUrl = "" + cno.ApplName = "" return cno } @@ -140,6 +166,7 @@ func copyCNOtoC(mqcno *C.MQCNO, gocno *MQCNO) { if gocno.SSLConfig != nil { gosco := gocno.SSLConfig mqsco = C.PMQSCO(C.malloc(C.MQSCO_LENGTH_5)) + C.memset((unsafe.Pointer)(mqsco), 0, C.size_t(C.MQSCO_LENGTH_5)) copySCOtoC(mqsco, gosco) mqcno.SSLConfigPtr = C.PMQSCO(mqsco) if gocno.Version < 4 { @@ -154,6 +181,7 @@ func copyCNOtoC(mqcno *C.MQCNO, gocno *MQCNO) { gocsp := gocno.SecurityParms mqcsp = C.PMQCSP(C.malloc(C.MQCSP_LENGTH_1)) + C.memset((unsafe.Pointer)(mqcsp), 0, C.size_t(C.MQCSP_LENGTH_1)) setMQIString((*C.char)(&mqcsp.StrucId[0]), "CSP ", 4) mqcsp.Version = C.MQCSP_VERSION_1 mqcsp.AuthenticationType = C.MQLONG(gocsp.AuthenticationType) @@ -164,10 +192,16 @@ func copyCNOtoC(mqcno *C.MQCNO, gocno *MQCNO) { mqcsp.AuthenticationType = C.MQLONG(C.MQCSP_AUTH_USER_ID_AND_PWD) mqcsp.CSPUserIdPtr = C.MQPTR(unsafe.Pointer(C.CString(gocsp.UserId))) mqcsp.CSPUserIdLength = C.MQLONG(len(gocsp.UserId)) + } else { + mqcsp.CSPUserIdPtr = nil + mqcsp.CSPUserIdLength = 0 } if gocsp.Password != "" { mqcsp.CSPPasswordPtr = C.MQPTR(unsafe.Pointer(C.CString(gocsp.Password))) mqcsp.CSPPasswordLength = C.MQLONG(len(gocsp.Password)) + } else { + mqcsp.CSPPasswordPtr = nil + mqcsp.CSPPasswordLength = 0 } mqcno.SecurityParmsPtr = C.PMQCSP(mqcsp) if gocno.Version < 5 { @@ -184,6 +218,14 @@ func copyCNOtoC(mqcno *C.MQCNO, gocno *MQCNO) { if gocno.CCDTUrl != "" { C.setCCDTUrl(mqcno, C.PMQCHAR(C.CString(gocno.CCDTUrl)), C.MQLONG(len(gocno.CCDTUrl))) } + + // The ApplName option to the CNO was introduced in MQ V9.1.2. To compile against + // older versions of MQ, setting of it has been moved to a C function. The function + // will free() the CString-allocated buffer regardless of MQ version. + if gocno.ApplName != "" { + C.setCnoApplName(mqcno, C.PMQCHAR(C.CString(gocno.ApplName)), C.MQ_APPL_NAME_LENGTH) + } + return } @@ -212,5 +254,8 @@ func copyCNOfromC(mqcno *C.MQCNO, gocno *MQCNO) { } C.freeCCDTUrl(mqcno) + + // ApplName is input-only so we don't need to do any version-specific processing + // for it in this function. return } diff --git a/mqmetric/channel.go b/mqmetric/channel.go index 21ec9a8..63467b5 100644 --- a/mqmetric/channel.go +++ b/mqmetric/channel.go @@ -6,7 +6,7 @@ storage mechanisms including Prometheus and InfluxDB. package mqmetric /* - Copyright (c) IBM Corporation 2016, 2018 + Copyright (c) IBM Corporation 2016, 2019 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -117,7 +117,6 @@ func InquireChannels(patterns string) ([]string, error) { func CollectChannelStatus(patterns string) error { var err error channelsSeen = make(map[string]bool) // Record which channels have been seen in this period - ChannelInitAttributes() // Empty any collected values @@ -138,12 +137,13 @@ func CollectChannelStatus(patterns string) error { // This would allow us to extract SAVED information too errCurrent := collectChannelStatus(pattern, ibmmq.MQOT_CURRENT_CHANNEL) - errSaved := collectChannelStatus(pattern, ibmmq.MQOT_SAVED_CHANNEL) - if errCurrent != nil { - err = errCurrent - } else { - err = errSaved - } + err = errCurrent + //errSaved := collectChannelStatus(pattern, ibmmq.MQOT_SAVED_CHANNEL) + //if errCurrent != nil { + // err = errCurrent + //} else { + // err = errSaved + //} } @@ -252,17 +252,21 @@ func collectChannelStatus(pattern string, instanceType int32) error { datalen, err = statusReplyQObj.Get(getmqmd, gmo, replyBuf) if err == nil { cfh, offset := ibmmq.ReadPCFHeader(replyBuf) - if cfh.Control == ibmmq.MQCFC_LAST { allReceived = true } if cfh.Reason != ibmmq.MQRC_NONE { continue } + // Returned by z/OS qmgrs but are not interesting + if cfh.Type == ibmmq.MQCFT_XR_SUMMARY || cfh.Type == ibmmq.MQCFT_XR_MSG { + continue + } key := parseChlData(instanceType, cfh, replyBuf[offset:datalen]) if key != "" { channelsSeen[key] = true } + } } @@ -277,6 +281,8 @@ func parseChlData(instanceType int32, cfh *ibmmq.MQCFH, buf []byte) string { connName := "" jobName := "" rqmName := "" + startDate := "" + startTime := "" key := "" parmAvail := true @@ -305,10 +311,23 @@ func parseChlData(instanceType int32, cfh *ibmmq.MQCFH, buf []byte) string { jobName = strings.TrimSpace(elem.String[0]) case ibmmq.MQCA_REMOTE_Q_MGR_NAME: rqmName = strings.TrimSpace(elem.String[0]) + case ibmmq.MQCACH_CHANNEL_START_TIME: + startTime = strings.TrimSpace(elem.String[0]) + case ibmmq.MQCACH_CHANNEL_START_DATE: + startDate = strings.TrimSpace(elem.String[0]) } } // Create a unique key for this channel instance + // + // The jobName does not exist on z/OS so it cannot be used to distinguish + // unique instances of the same channel name. Instead, we try to fake it with + // the channel start timestamp. That may still be wrong if lots of channel + // instances start at the same time, but it's a lot better than combining the + // instances badly. + if jobName == "" && platform == ibmmq.MQPL_ZOS { + jobName = startDate + ":" + startTime + } key = chlName + "/" + connName + "/" + rqmName + "/" + jobName // Look to see if we've already seen a Current channel status that matches @@ -353,8 +372,14 @@ func parseChlData(instanceType int32, cfh *ibmmq.MQCFH, buf []byte) string { // then use it to create the delta. Otherwise make the initial // value 0. if prevVal, ok := ChannelStatus.Attributes[attr].prevValues[key]; ok { - ChannelStatus.Attributes[attr].Values[key] = newStatusValueInt64(v - prevVal) + delta := v - prevVal + if delta < 0 { + delta = v + } + //fmt.Printf("Channel Status attr: %s key %s CurV %d PrevV %d Delta %d\n", attr, key, v, prevVal, delta) + ChannelStatus.Attributes[attr].Values[key] = newStatusValueInt64(delta) } else { + //fmt.Printf("Channel Status attr: %s key %s NewV %d PrevV N/A\n", attr, key, v) ChannelStatus.Attributes[attr].Values[key] = newStatusValueInt64(0) } ChannelStatus.Attributes[attr].prevValues[key] = v diff --git a/mqmetric/discover.go b/mqmetric/discover.go index e3125ff..a2e4a08 100755 --- a/mqmetric/discover.go +++ b/mqmetric/discover.go @@ -126,13 +126,15 @@ func VerifyConfig() (int32, error) { if err == nil { maxQDepth := v[ibmmq.MQIA_MAX_Q_DEPTH].(int32) // Function has tuning based on number of queues to be monitored - // Current published resource topics are approx 95 for qmgr - // ... and 35 per queue + // Current published resource topics are approx 16 subs for 95 elements on the qmgr + // ... and 35 elements per queue in 4 subs + // Round these to 20 and 5 for a bit of headroom // Make recommended minimum qdepth 60 / 10 * total per interval to allow one minute of data // as MQ publications are at 10 second interval by default (and no public tuning) - // and monitor collection interval is one minute - recommendedDepth := (100 + len(qList)*50) * 6 - if maxQDepth < int32(recommendedDepth) { + // and assume monitor collection interval is one minute + // Since we don't do pubsub-based collection on z/OS, this qdepth doesn't matter + recommendedDepth := (20 + len(qList)*5) * 6 + if maxQDepth < int32(recommendedDepth) && platform != ibmmq.MQPL_ZOS { err = fmt.Errorf("Warning: Maximum queue depth on %s may be too low. Current value = %d", replyQBaseName, maxQDepth) compCode = ibmmq.MQCC_WARNING } @@ -182,7 +184,7 @@ func DiscoverAndSubscribe(queueList string, checkQueueList bool, metaPrefix stri // Subscribe to all of the various topics if err == nil { - createSubscriptions() + err = createSubscriptions() } return err diff --git a/mqmetric/mqif.go b/mqmetric/mqif.go index 9f8fe8b..26965aa 100644 --- a/mqmetric/mqif.go +++ b/mqmetric/mqif.go @@ -1,7 +1,7 @@ package mqmetric /* - Copyright (c) IBM Corporation 2016, 2018 + Copyright (c) IBM Corporation 2016, 2019 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -62,10 +62,10 @@ func InitConnection(qMgrName string, replyQ string, cc *ConnectionConfig) error gocno := ibmmq.NewMQCNO() gocsp := ibmmq.NewMQCSP() + // Explicitly force client mode if requested. Otherwise use the "default" + // connection mechanism depending on what is installed or configured. if cc.ClientMode { gocno.Options = ibmmq.MQCNO_CLIENT_BINDING - } else { - gocno.Options = ibmmq.MQCNO_LOCAL_BINDING } gocno.Options |= ibmmq.MQCNO_HANDLE_SHARE_BLOCK @@ -125,6 +125,9 @@ func InitConnection(qMgrName string, replyQ string, cc *ConnectionConfig) error mqod.ObjectType = ibmmq.MQOT_Q mqod.ObjectName = "SYSTEM.ADMIN.COMMAND.QUEUE" + if platform == ibmmq.MQPL_ZOS { + mqod.ObjectName = "SYSTEM.COMMAND.INPUT" + } cmdQObj, err = qMgr.Open(mqod, openOptions) diff --git a/mqmetric/queue.go b/mqmetric/queue.go index a54ca9e..c0cd4da 100644 --- a/mqmetric/queue.go +++ b/mqmetric/queue.go @@ -6,7 +6,7 @@ storage mechanisms including Prometheus and InfluxDB. package mqmetric /* - Copyright (c) IBM Corporation 2018 + Copyright (c) IBM Corporation 2018,2019 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -216,6 +216,10 @@ func collectQueueStatus(pattern string, instanceType int32) error { if cfh.Reason != ibmmq.MQRC_NONE { continue } + // Returned by z/OS qmgrs but are not interesting + if cfh.Type == ibmmq.MQCFT_XR_SUMMARY || cfh.Type == ibmmq.MQCFT_XR_MSG { + continue + } parseQData(instanceType, cfh, replyBuf[offset:datalen]) } diff --git a/samples/README.md b/samples/README.md index 5d9333a..ae452c0 100644 --- a/samples/README.md +++ b/samples/README.md @@ -13,7 +13,7 @@ Where needed for the sample programs: * the default queue manager is "QM1" * the default queue is "DEV.QUEUE.1" -* the default topic is "DEV.BASE.TOPIC" +* the default topic is based on "DEV.BASE.TOPIC" (topic string is under dev/... tree) ## Description of sample programs Current samples in this directory include @@ -43,14 +43,14 @@ to a local queue manager (on the same machine) or for the client configuration t provided externally such as by the MQSERVER environment variable or the MQ Client Channel Definition Table (CCDT) file. The MQ_CONNECT_TYPE environment variable can be used to force client connections to be made, even if you have -installed the full server product; that variable is not needed if you have +installed the full server product; that variable is not needed if you have only installed the MQ client libraries. For example ``` export MQSERVER="SYSTEM.DEF.SVRCONN/TCP/localhost(1414)" - export MQ_CONNECT_TYPE=CLIENT + export MQ_CONNECT_TYPE=CLIENT go run amqsput.go DEV.QUEUE.1 QM1 ``` diff --git a/samples/amqsconn.go b/samples/amqsconn.go index da808d9..7683d4c 100644 --- a/samples/amqsconn.go +++ b/samples/amqsconn.go @@ -77,6 +77,10 @@ func main() { cno.ClientConn = cd cno.Options = ibmmq.MQCNO_CLIENT_BINDING + // MQ V9.1.2 allows applications to specify their own names. This is ignored + // by older levels of the MQ libraries. + cno.ApplName = "Golang 9.1.2 ApplName" + // Also fill in the userid and password if the MQSAMP_USER_ID // environment variable is set. This is the same variable used by the C // sample programs such as amqsput shipped with the MQ product. @@ -101,7 +105,7 @@ func main() { qMgr, err = ibmmq.Connx(qMgrName, cno) if err == nil { fmt.Printf("Connection to %s succeeded.\n", qMgrName) - d, _ := time.ParseDuration("5s") + d, _ := time.ParseDuration("3s") time.Sleep(d) qMgr.Disc() // Ignore errors from disconnect as we can't do much about it anyway rc = 0 diff --git a/samples/amqsconntls.go b/samples/amqsconntls.go new file mode 100644 index 0000000..57d34d0 --- /dev/null +++ b/samples/amqsconntls.go @@ -0,0 +1,129 @@ +/* +This is a short sample to show how to connect to a remote +queue manager in a Go program with a TLS connection without requiring external +client configuration such as a CCDT. The basic +parameters are still needed here - channel name and connection information - +along with the queue manager name. + +For example, run as + amqsconn QMGR1 "SYSTEM.SSL.SVRCONN" "myhost.example.com(1414)" + +If the MQSAMP_USER_ID environment variable is set, then a userid/password +flow is also made to authenticate to the queue manager. + +If an error occurs, the error is reported. +*/ +package main + +/* + Copyright (c) IBM Corporation 2017, 2019 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Contributors: + Mark Taylor - Initial Contribution +*/ + +import ( + "bufio" + "fmt" + "os" + "time" + + "github.com/ibm-messaging/mq-golang/ibmmq" +) + +func main() { + var qMgrName string + var err error + var qMgr ibmmq.MQQueueManager + var rc int + + if len(os.Args) != 4 { + fmt.Println("amqsconntls ") + fmt.Println("") + fmt.Println("For example") + fmt.Println(" amqsconntls QMGR1 \"SYSTEM.TLS.SVRCONN\" \"myhost.example.com(1414)\"") + fmt.Println("All parameters are required.") + os.Exit(1) + } + + // Which queue manager do we want to connect to + qMgrName = os.Args[1] + + // Allocate the MQCNO and MQCD structures needed for the CONNX call. + cno := ibmmq.NewMQCNO() + sco := ibmmq.NewMQSCO() + cd := ibmmq.NewMQCD() + + // Fill in required fields in the MQCD channel definition structure + cd.ChannelName = os.Args[2] + cd.ConnectionName = os.Args[3] + + // The CipherSpec must match what is configured on the corresponding SVRCONN + cd.SSLCipherSpec = "TLS_RSA_WITH_AES_128_CBC_SHA256" + + // The ClientAuth field says whether or not the client needs to present its own certificate + // This too must match the SVRCONN definition. + cd.SSLClientAuth = ibmmq.MQSCA_OPTIONAL + + // The keystore contains at least the certificate to verify the qmgr's cert (usually from + // a Certificate Authority) and optionally the client's own certificate. + // We could also optionally specify which certificate represents the client, based on its label + // but don't need to do this when using the MQSCA_OPTIONAL flag. + sco.KeyRepository = "./mykey" + + // Reference the CD structure from the CNO and indicate that we definitely want to + // use the client connection method. + cno.ClientConn = cd + cno.Options = ibmmq.MQCNO_CLIENT_BINDING + cno.SSLConfig = sco + + // Also fill in the userid and password if the MQSAMP_USER_ID + // environment variable is set. This is the same variable used by the C + // sample programs such as amqsput shipped with the MQ product. + userId := os.Getenv("MQSAMP_USER_ID") + if userId != "" { + scanner := bufio.NewScanner(os.Stdin) + csp := ibmmq.NewMQCSP() + csp.AuthenticationType = ibmmq.MQCSP_AUTH_USER_ID_AND_PWD + csp.UserId = userId + + fmt.Printf("Enter password for qmgr %s: \n", qMgrName) + // For simplicity (it doesn't help with understanding the MQ parts of this program) + // don't try to do anything special like turning off console echo for the password input + scanner.Scan() + csp.Password = scanner.Text() + + // Make the CNO refer to the CSP structure so it gets used during the connection + cno.SecurityParms = csp + } + + // And now we can try to connect. Wait a short time before disconnecting. + qMgr, err = ibmmq.Connx(qMgrName, cno) + if err == nil { + fmt.Printf("Connection to %s succeeded.\n", qMgrName) + d, _ := time.ParseDuration("3s") + time.Sleep(d) + qMgr.Disc() // Ignore errors from disconnect as we can't do much about it anyway + rc = 0 + } else { + fmt.Printf("Connection to %s failed.\n", qMgrName) + fmt.Println(err) + rc = int(err.(*ibmmq.MQReturn).MQCC) + } + + fmt.Println("Done.") + os.Exit(rc) + +} diff --git a/samples/amqspub.go b/samples/amqspub.go index 4d3f6ed..b69c12a 100644 --- a/samples/amqspub.go +++ b/samples/amqspub.go @@ -50,14 +50,14 @@ func mainWithRc() int { // The default queue manager and topic to be used. These can be overridden on command line. qMgrName := "QM1" - topic := "DEV.BASE.TOPIC" + topicString := "dev/GoTopic" fmt.Println("Sample AMQSPUB.GO start") // Get the topic and queue manager names from command line for overriding // the defaults. Parameters are not required. if len(os.Args) >= 2 { - topic = os.Args[1] + topicString = os.Args[1] } if len(os.Args) >= 3 { @@ -89,13 +89,13 @@ func mainWithRc() int { // the object through an ObjectName value or the ObjectString value or both. // For simplicity, here we work with just the ObjectString mqod.ObjectType = ibmmq.MQOT_TOPIC - mqod.ObjectString = topic + mqod.ObjectString = topicString topicObject, err = qMgrObject.Open(mqod, openOptions) if err != nil { fmt.Println(err) } else { - fmt.Println("Opened topic ", topic) + fmt.Println("Opened topic ", topicString) defer close(topicObject) } } @@ -127,7 +127,7 @@ func mainWithRc() int { if err != nil { fmt.Println(err) } else { - fmt.Println("Published message to", topic) + fmt.Println("Published message to", topicString) } } diff --git a/samples/amqssub.go b/samples/amqssub.go index 6ebc6bd..10942da 100644 --- a/samples/amqssub.go +++ b/samples/amqssub.go @@ -54,14 +54,14 @@ func mainWithRc() int { // The default queue manager and topic to be used. These can be overridden on command line. qMgrName := "QM1" - topic := "DEV.BASE.TOPIC" + topicString := "dev/GoTopic" fmt.Println("Sample AMQSSUB.GO start") // Get the queue and queue manager names from command line for overriding // the defaults. Parameters are not required. if len(os.Args) >= 2 { - topic = os.Args[1] + topicString = os.Args[1] } if len(os.Args) >= 3 { @@ -97,7 +97,7 @@ func mainWithRc() int { // When opening a Subscription, MQ has a choice of whether to refer to // the object through an ObjectName value or the ObjectString value or both. // For simplicity, here we work with just the ObjectString - mqsd.ObjectString = topic + mqsd.ObjectString = topicString // The qObject is filled in with a reference to the queue created automatically // for publications. It will be used in a moment for the Get operations @@ -105,7 +105,7 @@ func mainWithRc() int { if err != nil { fmt.Println(err) } else { - fmt.Println("Subscription made to topic ", topic) + fmt.Println("Subscription made to topic ", topicString) defer close(subscriptionObject) } } diff --git a/samples/pubsub.sh b/samples/pubsub.sh index 422cbef..0bca4b1 100755 --- a/samples/pubsub.sh +++ b/samples/pubsub.sh @@ -2,7 +2,7 @@ # first and in the background. Give it a chance to start. Then run the # publisher -go run amqssub.go DEV.BASE.TOPIC QM1 & +go run amqssub.go dev/GoTopic QM1 & sleep 1 -go run amqspub.go DEV.BASE.TOPIC QM1 +go run amqspub.go dev/GoTopic QM1 wait