Using PHP to Open MSMQ Queues

こ雲淡風輕ζ 提交于 2019-12-05 16:59:39

From here, you already know the parameters are:

Function Open(Access, ShareMode)

and they also say that

Access can be set to one of the following:

MQ_PEEK_ACCESS: Messages can only be looked at. They cannot be removed from the queue.

MQ_SEND_ACCESS: Messages can only be sent to the queue.

MQ_RECEIVE_ACCESS: Messages can be retrieved (read and removed) from the queue, peeked at, or purged. See the description of the ShareMode argument for information on limiting who can retrieve messages from the queue.

MQ_PEEK_ACCESS | MQ_ADMIN_ACCESS: Messages in the local outgoing queue can only be peeked at (read without being removed from the queue).

MQ_RECEIVE_ACCESS | MQ_ADMIN_ACCESS: Messages in the local outgoing queue can be retrieved (read and removed from the queue), peeked at (read without being removed from the queue), or purged (deleted).

In MSDN's docs for MQACCESS they give you the numerical values for the constants:

typedef  enum 
{
  MQ_RECEIVE_ACCESS = 1,
  MQ_SEND_ACCESS = 2,
  MQ_PEEK_ACCESS = 0x0020,
  MQ_ADMIN_ACCESS = 0x0080
} MQACCESS;

The second parameter, ShareMode:

ShareMode specifies who can access the queue. Set to one of the following:

MQ_DENY_NONE: Default. The queue is available to all members of the Everyone group. This setting must be used if Access is set to MQ_PEEK_ACCESS or MQ_SEND_ACCESS.

MQ_DENY_RECEIVE_SHARE: Limits those who can retrieve messages from the queue to this process. If the queue is already opened for retrieving messages by another process, this call fails and an MQ_ERROR_SHARING_VIOLATION (0xC00E0009) error is generated. Applicable only when Access is set to MQ_RECEIVE_ACCESS.

These constants are:

Const MQ_DENY_NONE = 0
Const MQ_DENY_RECEIVE_SHARE = 1

it's indeed a little harder to find, but you can get it for example here, which is not much a reliable source, but I believe it's correct.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!