Skip to main contentCarbon Design System

Message driven bean scripting

Customers often need to add new Message Driven Beans for consuming messages from an external JMS server. Maximo scripted MDBs from 7.6.1.3 or 8.8.

To set up MDB with scripting:

  1. Create the following vanilla py script (for example, named as CUSTMDB).
service.log("msg received with id "+str(jmsmsg.getJMSMessageID()))

Note that jmsmsg refers to the javax.jms.Message object representing the message from the JMS queue.

  1. Assume that you are going to consume message from an external continous queue named extcqin. Therefore, you will use the external system EXTSYS1 to import a file. For example, you import an asset with the content.

  2. Modify the mboejb ejb jar xml to add a script MDB using the ejb-jar.xml file. This connects the script to the MDB.

<message-driven id="MessageDriven_JMSContQueueProcessor_3">
<ejb-name>JMSScriptListenerBean-1</ejb-name>
<ejb-class>psdi.iface.jms.JMSScriptListenerBean</ejb-class>
<transaction-type>Container</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
<env-entry>
<env-entry-name>SCRIPTNAME</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>CUSTMDB</env-entry-value>

Note the ejb class psdi.iface.jms.JMSScriptListenerBean and the env entry SCRIPTNAME has the name of the script. A script on an object structure such as MXITEM, can impact the processing of item data through REST, application Import, Enterprise Service and Invocation/Publish Channel.

  1. Deploy the customization.

Assuming that the activation spec and queue setup are all done, you should be able to see the log statement appear as you start pushing messages into the queue.