共用方式為


Creating Queue Examples

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

To create a queue, you need to set the path name property of the queue, set any optional queue properties to define the queue's behavior (such as the label property of the queue, and then make the call to create the queue.

Queue Path Name

The path name of the queue includes the following information.

  • The computer where the messages of the queue will be stored (for private queues this is the computer where the queue is registered.

  • An optional PRIVATE$ keyword that indicates that the queue is a private queue (if this keyword is not included Message Queuing creates a public queue).

  • A user friendly name for the queue.

For a complete description of path names, see Queue Path Names.

Registering Queues

Message Queuing registers public queues in the directory service and private queues on a specific computer.

When a public queue is created, its name, property settings, security descriptor, and the name of the computer where the queue's messages will be stored are all registered in the directory service.

When a private queue is created, its name, property settings, and security descriptor are all registered on the computer specified in the queue's path name.

Creating Transactional and Nontransactional Queues

Creating transactional and nontransactional queues is very similar. The only difference is the setting of the transactional level property for the queue. However, this done differently depending on the development language being used. Examples of creating transactional and nontransactional messages are provided in the list below.

Code Examples

For code examples for creating various sorts of queues, see the following language-specific examples.

Example Language
Creating a queue C/C++ Code Example: Creating a Queue

 C/C++ COM Code Example: Creating a Queue

 Visual Basic Code Example: Creating a Queue

 VBScript Code Example: Creating a Queue
Creating a transactional queue C/C++ Code Example: Creating a Transactional Queue

 C/C++ COM Code Example: Creating a Transactional Queue

 Visual Basic Code Example: Creating a Transactional Queue