Getting RC 2045 MQRC_OPTION_NOT_VALID_FOR_TYPE when trying to get/browse a message from a non-local queue

Technote (FAQ)

Question

You put a message into a WebSphere MQ (WMQ) remote queue definition in local QMgr1 and the message is sent to an associated queue in remote QMgr2. However, you want to know if you can read a message from a remote queue definition? Similarly with clustered queues: you can put a message into a definition of a clustered queue which has no local storage in QMgr1 and it is sent to the corresponding local queue in QMgr2. You want to know if you can read a message from a definition of a clustered queue?

Answer

Regarding the MQ GET function, an application can ONLY get, browse or read messages from a local queue which resides inside a queue manager, such as QMgr1. It is NOT possible to get or browse messages when connected to QMgr1 from a remote queue which resides in another queue manager, such as QMgr2. This applies to remote queue definitions and to clustered queues, where the local queue is in a remote queue manager. It is not possible to extrapolate the behavior from the PUT function to the GET function. The PUT function allows you to connect to QMgr1 and then put a message into a remote queue which resides in QMgr2, via a remote queue definition and a transmission queue, or via a clustered queue and associated MQ clustering framework.