Reputation: 21
I would like to know how to add dynamicly custom properties to a JMS Provider with Jython script of Websphere V7. Can anyone provide an example script?
With dynamicly I mean no direct address with file path because it has to run on different machines. *.xml files are in different locations and profiles.
Here an example how the JMS provider is beeing created. You can use it to write the command to add the custom properties for this JMS Provider.
try:
jmsProvider=AdminConfig.getid("/JMSProvider:MQProvider1/")
if jmsProvider == "":
name = ["name", "MQProvider1"]
extICF = ["externalInitialContextFactory", "org.apache.activemq.jndi.ActiveMQWASInitialContextFactory" ]
extPURL = ["externalProviderURL", "tcp://server:1234"]
jmspAttrs = [name, extICF, extPURL]
AdminConfig.create("JMSProvider", node, jmspAttrs)
AdminConfig.save()
except:
print '[ERROR] Task: #1'
print sys.exc_type, sys.exc_value
Upvotes: 0
Views: 123
Reputation: 21
I discovered my own how to add custom properties for JMS in Websphere V7:
try:
jmsProvider=AdminConfig.getid("/JMSProvider:MQProvider1/") props = AdminConfig.create('J2EEResourcePropertySet', jmsProvider, []) AdminConfig.create('J2EEResourceProperty', props, '[[name "name1"] [value "value1"]]') AdminConfig.create('J2EEResourceProperty', props, '[[name "name2"] [value "value2"]]') AdminConfig.save()
except:
print '[ERROR] Task: #2' print sys.exc_type, sys.exc_value
Upvotes: 1