Skip to content

Getting MQRC_ENVIRONMENT_ERROR [2012] error after updating to v2.1.0 #192

@AyushBhadauriaI6

Description

@AyushBhadauriaI6

Hello, I recently upgraded my ibmmq package version to v2.1.0 and getting following error while trying to use the Get operation to read messages from the queue

(MQError) GET[async]: MQCC = MQCC_FAILED [2] MQRC = MQRC_ENVIRONMENT_ERROR [2012]

I have able to subscribe to the queue using Get Operation correctly with version v1.0.6. Note, that I have disabled useCtl so that Get operation does not require Ctl to finish reading messages using setTuningParameters({ useCtl: false });

Here is the code block I am using to subscribe to the queue.

    async createSubscription(queueName) {

        const objectDescriptor = new MQOD();
        objectDescriptor.ObjectType = MQC.MQOT_Q;
        objectDescriptor.ObjectName = queueName;

        const queue = await OpenPromise(
            await this.connectionHandle,
            objectDescriptor,
            MQC.MQOO_INPUT_AS_Q_DEF,
        );

        this.logger.debug('createSubscription', { queueName });

        const getMessageOptions = new MQGMO();

        getMessageOptions.Options = (
            MQC.MQGMO_NO_SYNCPOINT |
            MQC.MQGMO_WAIT |
            MQC.MQGMO_FAIL_IF_QUIESCING |
            MQC.MQGMO_CONVERT
        );
        getMessageOptions.MatchOptions = MQC.MQMO_NONE;
        getMessageOptions.WaitInterval = MQC.MQWI_UNLIMITED;
    
        Get(
            queue,
            new MQMD(),
            getMessageOptions,
            (error, ...message) => {
                if (error instanceof Error) {
                    throw new Error(error);
                }

                return message;
            },
        );
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions