Message-driven bean scripting

You can add new message-driven beans to use messages from an external Java™ Message Service (JMS) server.

To set up message-driven beans with scripting, create the following Python script, for example, named as CUSTMDB.
service.log("msg received with id "+str(jmsmsg.getJMSMessageID()))

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

Assume that you are going to use messages from an external continuous queue named extcqin. Therefore, you use the external system EXTSYS1 to import a file. For example, you import an asset with the content.

Modify the mboejb bean JAR XML to add a script message-driven bean by using the ejb-jar.xml file. Doing this connects the script to the message-driven bean.
    <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 Enterprise JavaBeans class psdi.iface.jms.JMSScriptListenerBean and the env-entry SCRIPTNAME have 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 and publish channel.

Deploy the customization.

If the activation specification and queue setup are done, you can see the log statement appear as you start pushing messages into the queue.