Work with model queues on IBM i
This section contains examples of some of the commands used to manage model queues. All the commands shown are also available using options from the WRKMQMQ command panel.
A queue manager creates a dynamic queue if it receives an MQI call from an application specifying a queue name that has been defined as a model queue. The name of the new dynamic queue is generated by the queue manager when the queue is created. A model queue is a template that specifies the attributes of any dynamic queues created from it.
Model queues provide a convenient method for applications to create queues as they are required.
Defining a model queue
You define a model queue with a set of attributes in the same way that you define a local queue. Model queues and local queues have the same set of attributes, except that on model queues we can specify whether the dynamic queues created are temporary or permanent. (Permanent queues are maintained across queue manager restarts, temporary ones are not). For example:CRTMQMQ QNAME('green.model.queue') QTYPE(*MDL) DFNTYPE(*PERMDYN)
This command creates a model queue definition. From the DFNTYPE attribute, the actual queues created from this template are permanent dynamic queues. The attributes not specified are automatically copied from the SYSYTEM.DEFAULT.MODEL.QUEUE default queue.
We can use the REPLACE *YES attribute when you define model queues, in the same way that we use them with local queues.
Use other commands with model queues
We can use the appropriate commands to display or alter a model queue's attributes. For example:/* Display the model queue's attributes */ DSPMQMQ MQMNAME(MYQUEUEMANAGER) QNAME('green.model.queue') /* ALTER the model queue to enable puts on any */ /* dynamic queue created from this model. */ CHGMQMQ MQMNAME(MYQUEUEMANAGER) QNAME('blue.model.queue') PUTENBL(*YES)Parent topic: Manage IBM MQ for IBM i using CL commands