Starting queue managers in C

The mqeQueueManager_new function loads a queue manager for an established registry. To do this, you need information supplied by a queue manager parameter structure and a registry parameter structure.

The following example shows how you can set these structures to their default values, supplying only the directories of the queue store and registry:
  MQeQueueManagerHndl hQueueManager;
  MQeRegistryParms regParms = REGISTRY_INIT_VAL;
  MQeQueueManagerParms qmParms = QMGR_INIT_VAL;
  regParms.hBaseLocationName = hRegistryDirectory;
  qmParms.hQueueStore = hStore;
  qmParms.opFlags = QMGR_Q_STORE_OP;
  rc = mqeQueueManager_new(&exceptBlock,
                           &hQueueManager, hQMName,
                           &regParams, &qmParms);
This creates a queue manager and loads its persistent information from the registry and creates queues. However, you must start the queue manager to:
  • Create messages
  • Get and put messages
  • Process administration messages, using the administration queue
Note: In C, the queues are activated on starting the queue manager.
To start the queue manager, use
  rc = mqeQueueManager_start(&hQueueManager, &exceptBlock);
Once the queue manager is started, messaging operations can take place and any queues that have messages on them are loaded.
To stop the queue manager, use:
  rc = mqeQueueManager_stop(&hQueueManager, &exceptBlock);
Once stopped, you can restart the queue manager as required.
At the end of the application, you must free the queue manager to release any resources it uses, for example memory. First, stop the queue manager and then use:
  rc = mqeQueueManager_free(&hQueueManager, &exceptBlock);

Terms of use | WebSphere software

(c) Copyright IBM Corporation 2004, 2005. All rights reserved.