Sunday, December 3, 2017

Creating J2CActivationSpec using jython for JDBC Inbound Adapter with event store

To create a J2C Activation Spec using Jython script you can use below AdminTask


adapter = AdminConfig.getid("/Cell:myCell/Node:MyNode/J2CResourceAdapter:IBM WebSphere Adapter for JDBC/')

AdminTask.createJ2CActivationSpec(adapterId, '[-messageListenerType com.ibm.j2ca.base.ExtendedInboundListener -name  MyAdapterListenerSpec -jndiName as/MyAdapterJndi -description "Adapter to pull events from inbound database table" -authenticationAlias  mydatbaseAuthAlias]')
AdminConfig.save()


Once you create the J2C Activation Spec, you will have to configure the custom properties, in case you are using a different table names other than defaults.  In order to do that you first have to find the J2EEResourceProperty and set the values.

To update eventTableName, (other values can be modified like eventTypeFilter, DatabaseVendor, connectionType, jdbcDriverClass, dataSourceJNDINane and many more), query and get the id first and use that to modify existing value.


eventTableName = AdminConfig.getid('/J2CActivationSpec:MyAdapterListenerSpec/J2EEResourceProperty:eventTableName/')
AdminConfig.modify(eventTableName , '[[name "eventTableName] [type "java.lang.String"] [description "eventTableName"] [ value "MyAdapterInboundTable"] [required "false"]]')
AdminConfig.save()


Setting up the custom J2EE resource property was challenging, once you know the patter to use to query and get id, we can use same pattern to setup custom properties.



No comments: