WebSphere

Creating an event group with scripting

You can create an event group using a Jacl or Jython script.

Before you begin

Before starting this task, the wsadmin tool must be running. See the WebSphere® Application Server documentation for more information.

About this task

Perform the following steps to configure a new event group.
Procedure
  1. Identify the Common Event Infrastructure provider ID.
    • Using Jacl:
      set providerid [$AdminConfig getid \
      /Cell:mycell/Node:mynode/Server:myserver/ \
      EventInfrastructureProvider:/]
    • Using Jython:
      providerid =
      AdminConfig.getid
       ('/Cell:mycell/Node:mynode/Server:myserver/EventInfrastructureProvider:/')
       print providerid
    Example output:
    EventInfrastructureProvider(cells/mycell/nodes/mynode/servers/myserver|
     resources-cei.xml#EventInfrastructureProvider_1)
  2. Obtain the event group list.
    • Using Jacl:
      set eventGroupProfileId [lindex [$AdminConfig list 
      EventGroupProfileList $providerid] 0]
    • Using Jython:
      eventGroupProfileId = AdminConfig.list('EventGroupProfileList',providerid)
  3. Set the required attributes.
    • Using Jacl:
      set name [ list eventGroupName "EventGroupName" ]
      
      # escape all ‘[‘ characters in the event selector string.
      set selectorString [ list eventSelectorString "Set event selector here"]
      
      # leave blank if events should not be published using JMS
      set JNDIName [ list topicJNDIName "Set topic JNDI name here"]
      
      # leave blank if events should not be published using JMS
      set connectionFactoryJNDIName [ list topicConnectionFactoryJNDIName \
        "Set topic connection factory JNDI name here" ]
      
      set persistEventsFlag [ list persistEvents "true" ]
      
      # custom properties include compatibility mode
      set CompatibilityMode [list [list name compatibilityMode] \
        [list description ""] \
        [list required false] \
        [list type java.lang.Boolean] \
        [list value "false"] ] \
      set resProp [list [list resourceProperties [list \
        $CompatibilityMode ]]]
    • Using Jython:
      Name = ['eventGroupName', 'EventGroupName' ]
      SelectorString = ['eventSelectorString', 'Set event selector here']
      
      # leave blank if events should not be published using JMS
      JNDIName = [ 'topicJNDIName', 'Set topic JNDI name here']
      
      # leave blank if events should not be published using JMS
      ConnectionFactoryJNDIName = ['topicConnectionFactoryJNDIName', \
        'Set topic connection factory JNDI name here']
      
      PersistEventsFlag = ['persistEvents', 'true']
      
      # custom properties include compatibility mode
      compatibilityName = ['name','compatibilityMode']
      compatibilityDescription = ['description','']
      compatibilityRequired = ['required', 'false']
      compatibilityType = ['type', 'java.lang.Boolean']
      compatibilityValue = ['value', 'false']
      CompatibilityMode = [compatibilityName, 
                           compatibilityDescription,
                           compatibilityRequired, \
                           compatibilityType,
                           compatibilityValue]
      customProperties = ['propertySet', [['resourceProperties',
                          [CompatibilityMode]]]]
  4. Set the properties for the new event group.
    • Using Jacl:
      set properties [ list $name $selectorString $JNDIName \ 
      $connectionFactoryJNDIName $persistEventsFlag [list propertySet \
      $resProp]]
    • Using Jython:
      properties = [Name,SelectorString,JNDIName,ConnectionFactoryJNDIName, \
                    PersistEventsFlag,customProperties]
    Example output:
    [['eventGroupName', 'EventGroupName'], ['eventSelectorString', 
    'Set event selector here'], ['topicJNDIName', 'Set topic JNDI 
    name here'], ['topicConnectionFactoryJNDIName', 'Set topic 
    connection factory JNDI name here'], ['persistEvents','true'], 
    ['propertySet', [['resourceProperties', [[['name', 
    'compatibilityMode'], ['description', ''], ['required', 'false'], 
    ['type', 'java.lang.Boolean'], ['value', 'false']]]]]]]
  5. Create the event group.
    • Using Jacl:
      set result [ $AdminConfig create EventGroupProfile
       $eventGroupProfileId $properties ]
    • Using Jython:
      print AdminConfig.create('EventGroupProfile',
       eventGroupProfileId, properties)
    Example output:
    (cells/mycell/nodes/mynode/servers/myserver|resources-cei.xml#EventGroupProfile_1)
  6. Save the configuration changes.
  7. In a network deployment environment only, synchronize the node.
  8. Restart the server.

task Task topic

Terms of use | Feedback


Timestamp icon Last updated: 22 June 2010


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic/com.ibm.websphere.cei.z.620.doc/doc/tcei_create_event_group_script.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
This information center is powered by Eclipse technology (http://www.eclipse.org).