Work with services

Service objects are a means by which additional processes can be managed as part of a queue manager. With services, we can define programs that are started and stopped when the queue manager starts and ends. IBM MQ services are always started under the user ID of the user who started the queue manager.

Service objects can be either of the following types:

    Server
    A server is a service object that has the parameter SERVTYPE specified as SERVER. A server service object is the definition of a program that is executed when a specified queue manager is started. Server service objects define programs that typically run for a long time. For example, a server service object can be used to execute a trigger monitor process, such as runmqtrm.

    Only one instance of a server service object can run concurrently. The status of running server service objects can be monitored using the MQSC command, DISPLAY SVSTATUS.

    Command
    A command is a service object that has the parameter SERVTYPE specified as COMMAND. Command service objects are similar to server service objects, however multiple instances of a command service object can run concurrently, and their status cannot be monitored using the MQSC command DISPLAY SVSTATUS.

    If the MQSC command, STOP SERVICE, is executed, no check is made to determine whether the program started by the MQSC command, START SERVICE, is still active before stopping program.

  • Defining a service object
    You define a service object with the MQSC command DEFINE SERVICE.
  • Manage services
    By using the CONTROL parameter, an instance of a service object can be either started and stopped automatically by the queue manager, or started and stopped using the MQSC commands START SERVICE and STOP SERVICE.
  • Additional environment variables
    When a service is started, the environment in which the service process is started is inherited from the environment of the queue manager. It is possible to define additional environment variables to be set in the environment of the service process by adding the variables we want to define to one of the service.env environment override files.
  • Replaceable inserts on service definitions
    In the definition of a service object, it is possible to substitute tokens. Tokens that are substituted are automatically replaced with their expanded text when the service program is executed. Substitute tokens can be taken from the following list of common tokens, or from any variables that are defined in the file, service.env.
  • Examples of using service objects
    The services in this section are written with UNIX style path separator characters, except where otherwise stated.

Parent topic: Work with local IBM MQ objects


Related information