Work with WebSphere MQ queue properties files
We can use properties files to create or change WebSphere MQ queue properties.
Determine the changes to make to the WebSphere MQ queue configuration or its configuration objects.
Start the wsadmin scripting tool. To start wsadmin using the Jython language, run the wsadmin -lang Jython command from the bin directory of the server profile.
Using a properties file, we can create, modify, or delete a WebSphere MQ queue object and its configuration properties.
Run administrative commands using wsadmin to extract a properties file for a WebSphere MQ queue, validate the properties, and apply them to the configuration.
Action Procedure create Set at least required properties and then run the applyConfigProperties command. modify Edit properties and then run the applyConfigProperties command. delete Uncomment #DELETE=true and run the deleteConfigProperties command. delete Property To delete one or more properties, run deleteConfigProperties with only those properties to delete in the properties file. Optionally, we can use interactive mode with the commands:
AdminTask.command_name('-interactive')
- Create a WebSphere MQ queue and its properties.
- Create a properties file for an MQQueue object.
Open an editor and create a WebSphere MQ queue properties file. We can copy the example properties file in this step into an editor and modify the properties as needed for the situation.
An example properties file for an MQQueue object with a name of myName and a JNDI name of myJndiName under a JMSProvider at the cell scope follows:
# # Header # ResourceType=MQQueue ImplementingResourceType=JMSProvider ResourceId=Cell=!{cellName}:JMSProvider=WebSphere MQ JMS Provider:MQQueue=jndiName#myJndiName # # #Properties # queueManagerPort=0 #integer,default(0) password=null readAhead=YES #ENUM(QUEUE_DEFINED|YES|NO),default(YES) specifiedExpiry=0 #long,default(0) queueManagerHost=null baseQueueName=queueName # required baseQueueManagerName=null providerType=null #readonly decimalEncoding=Normal #ENUM(Normal|Reversed),default(Normal) serverConnectionChannelName=null expiry=APPLICATION_DEFINED #ENUM(APPLICATION_DEFINED|SPECIFIED|UNLIMITED),defaul t(APPLICATION_DEFINED) sendAsync=YES #ENUM(QUEUE_DEFINED|YES|NO),default(YES) userName=null integerEncoding=Normal #ENUM(Normal|Reversed),default(Normal) specifiedPriority=0 #integer,default(0) jndiName=myJndiName# required CCSID=0 #integer,default(0) category=null description=null useNativeEncoding=false #boolean,default(false) boolean=null targetClient=JMS #ENUM(JMS|MQ),default(JMS) priority=APPLICATION_DEFINED #ENUM(APPLICATION_DEFINED|SPECIFIED|QUEUE_DEFINED), default(APPLICATION_DEFINED) persistence=APPLICATION_DEFINED #ENUM(APPLICATION_DEFINED|HIGH|NONPERSISTENT|PERSISTENT|QUEUE_DEFINED),default(APPLICATION_DEFINED) provider=WebSphere MQ JMS Provider #ObjectName(JMSProvider),readonly floatingPointEncoding=IEEENormal #ENUM(IEEENormal|IEEEReversed|S390),default(IEEENormal) readAheadClose=DELIVERALL #ENUM(DELIVERCURRENT|DELIVERALL),default(DELIVERALL) name=myName # required EnvironmentVariablesSection # # #Environment Variables cellName=WASCell06
- Run the applyConfigProperties command to create an MQQueue configuration.
Running the applyConfigProperties command applies the properties file to the configuration. In this Jython example, the optional -reportFileName parameter produces a report named report.txt:
AdminTask.applyConfigProperties(['-propertiesFileName myObjectType.props -reportFileName report.txt '])
- Modify an existing WebSphere MQ queue.
- Obtain a properties file for the WebSphere MQ queue to change.
We can extract a properties file for an MQQueue using the extractConfigProperties command.
- Open the properties file in an editor and change the properties as needed.
Ensure that the environment variables in the properties file match the system.
- Run the applyConfigProperties command to change a WebSphere MQ queue configuration.
- Delete the entire WebSphere MQ queue object or its properties.
To delete the entire object, specify DELETE=true in the header section of the properties file and run the deleteConfigProperties command; for example:
AdminTask.deleteConfigProperties('[-propertiesFileName myObjectType.props -reportFileName report.txt]')
To delete one or more properties, specify only those properties to delete in the properties file and run deleteConfigProperties.
Results
We can use the properties file to configure and manage the WebSphere MQ queue object.
What to do next
Save the changes to the configuration.
Related tasks
Extracting properties files Create server, cluster, application, or authorization group objects using properties files and wsadmin scripting Delete server, cluster, application, or authorization group objects using properties files
PropertiesBasedConfiguration (AdminTask)