This script simply searches all available queues anywhere on a ManagedServer until it finds a match.
def controlConsumption(queue, suspend): found = False serverRuntime() myjmsruntimes = ls('/JMSRuntime/', returnMap='true') for myjmsruntime in myjmsruntimes: myjmsservers = ls('/JMSRuntime/' + myjmsruntime + '/JMSServers', returnMap='true') for myjmsserver in myjmsservers: jmsserverroot = '/JMSRuntime/' + myjmsruntime + '/JMSServers/' + myjmsserver + '/' cd(jmsserverroot) cd('Destinations') mydestinations = ls('c', returnMap='true') #print mydestinations for mydestination in mydestinations: if (mydestination.endswith('@' + queue)): found = True #print "cding into", jmsserverroot + mydestination cd(jmsserverroot + 'Destinations/' + mydestination) if (suspend): cmo.pauseConsumption() print "\n##############\nconsumption paused on ", mydestination, "\n##############\n" else: cmo.resumeConsumption() print "\n##############\nconsumption resumed on ", mydestination, "\n##############\n" if (not found): print "ERROR: queue ", queue, " could not be found"
where queue is just the Queue name (not the JNDI), and suspend is True or False.
No comments:
Post a Comment