MSMQQueueInfo.Create
A version of this page is also available for
4/8/2010
The Create method of the MSMQQueueInfo object creates a public or private queue based on the properties of the MSMQQueueInfo object.
Syntax
HRESULT Create(
VARIANT* IsTransactional,
VARIANT* IsWorldReadable
);
Parameters
IsTransactional
Optional. The default is FALSE.When TRUE, indicates that the queue is a transactional queue. All messages sent to a transactional queue or read from a transactional queue must be done as part of a transaction.
IsWorldReadable
Optional. The default is FALSE.When TRUE, anyone can read the messages in the queue and its queue journal.
When FALSE, only the owner can read the messages.
Return Value
The following table describes the common return values.
Value | Description |
---|---|
S_OK |
Success |
E_INVALIDARG |
One or more arguments are invalid |
E_NOTIMPL |
The function contains no implementation |
E_OUTOFMEMORY |
Out of memory |
Remarks
You must always specify the pathname of the queue before calling MSMQQueueInfo.Create. The MSMQQueueInfo.PathName property tells Message Queuing the following:
- Where to store the messages of the queue
- If the queue is public or private
- The name of the queue
When setting this property, you can specify the UNC or DNS pathname for the queue.
Optional queue properties
Setting other queue properties is optional. If a queue property is not set before Create is called, its default value is used when the queue is created.
Registering queues
Message Queuing registers public queues in the directory service and private queues on the local computer. All queues exist until deleted explicitly.
Creating private queues
Private queues can only be created on the local computer.
It is the responsibility of the application to ensure that no other private queues with the same name exists on the local computer. (If a queue with the same name exists, an MQ_ERROR_QUEUE_EXISTS error is returned when Create is called.)
Creating transactional queues
To create a transactional queue, set the IsTransactional parameter to TRUE.
Creating foreign queues
Foreign public queues (queues located outside the enterprise) are created in the same way as a Message Queuing public queue.
For foreign queues, the MSMQQueueInfo.PathName property specifies the name of the foreign computer as it is defined in the directory service.
Specifying target journaling
To specify target journaling, set MSMQQueueInfo.Journal and MSMQQueueInfo.JournalQuota.
Creating public queues from a collection of queues
Typically, queues are not created from MSMQQueueInfo objects found in a MSMQQueueInfos object because the queue exists.
However, you can create a queue from an MSMQQueueInfo object if you delete the existing queue and then change the MSMQQueueInfo.PathName or MSMQQueueInfo.FormatName property of the queue.
A new queue is created based on the new pathname or format name.
Opening queues
After the queue is created, the MSMQQueueInfo object can be opened multiple times. For example, the same MSMQQueueInfo object can be used to open the queue for sending messages and for retrieving messages.
Changing access control on the queue
Access control can be changed by setting isWorldReadable.
If this parameter is not set, its default value specifies Message Queuing default security.
Following are the default values for the security descriptor.
Default value | Description |
---|---|
Owner |
The process user. |
Group |
The process group. |
DACL |
Full control for the creator of the queue. All other processes can get queue properties, get queue security, and send messages to the queue. |
SACL |
None. |
Offline operations
Applications that are running offline cannot create public queues while they are offline. Applications must have access to the directory service to create a public queue.
Directory service propagation delays
When creating a public queue, some clients might not be able to see the new queue registered in the directory service even though the queue exists.
Changes to the directory service, such as creating a public queue, are propagated from domain controller to domain controller, which can cause delays in the availability of new information. Consequently, clients using a specific domain controller might not be able to open the queue, even though it exists.
Propagation delays, including communication network delays such as down links, are controlled by the MSMQ Administrator.
Requirements
Header | mqoai.h |
Library | mqoa.lib |
Windows Embedded CE | Windows CE .NET 4.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |