...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
public class CRMProcessSmsRunBean extends CRMProcessRunBean { @EJB private smsMessageRunDefinitionXMLUtilBean messageRunDefinitionXMLUtilBean; ... public void executeMessageProcess(CRMDOProcessRunLog processRun) throws Exception { CRMDOProcessRunDefinition processRunDefinition = processRun.getProcessRunDefinition(); smsMessageRunDefintion messageRunDefinition= new smsMessageRunDefintion(); messageRunDefinition.setProcessRunDefinition(processRunDefinition); messageRunDefinition = messageRunDefinitionXMLUtilBean.loadProcessingRunDefinition(messageRunDefinition); CRMDOProvProvider provProvider = exsetProviderBean.loadEffective(); provProvider = exsetProviderBean.setObjectsFromXML(provProvider); processRun.setStatus(ProcessRunLogStatus.IN_PROGRESS); processRun.setStartDate(getCurrentDate()); processRunLogBean.save(processRun); Boolean processComplete = new Boolean(false); JDBCConnection connection= null; try { //At this point is implemented the threats mechanism like in Implement a Multithreaded Process section catch (Exception e) { saveEntityLogRecord( processRun, "", "", ProcessRunLogEntityStatus.FAILED, e.getClass().getSimpleName(), ExceptionUtil.getStackTrace(e)); processRun.setEndDate(getCurrentDate()); processRun.setStatus(ProcessRunLogStatus.FAILED); processRunLogBean.save(processRun); processRun = saveNextProcessRun(processRun); if(connection!=null) connection.close(); } if (processComplete) { processRun.setStatus(ProcessRunLogStatus.COMPLETED); processRun.setEndDate(getCurrentDate()); processRun = saveNextProcessRun(processRun); processRunLogBean.save(processRun); } } ... } |
CRMProcessSmsRunBean must be also bind to the server by specifying the EJB in the ibm-ejb-jar-bnd.xml binding file.This xml found in CRMEJB > ejbModule > METADATA-INF
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<ejb-jar-bnd>
...
<session name="CRMProcessProcessSmsRun" simple-binding-name="ejb/CRMProcessProcessSmsRun" />
...
</ejb-jar-bnd> |
The process must also be added in the CrmEJB/ejbModule/META-INF/ibm-ejb-jar-ext.xml to define how much time the process could been executing as follows:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
...
<session name="CRMProcessProcessSmsRun">
<global-transaction transaction-time-out="86400" />
<time-out value="86400" />
</session>
...
|
Then the process, should be mentioned in CrmEJB/ejbModule/META-INF/jboss-ejb3.xml file where we declare in enterprise beans, the process and in assembly descriptor we mention the timeout of the execution as follows:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
...
<session>
<ejb-name>CRMProcessProcessSmsRunBean</ejb-name>
<ejb-class>com.crm.process.provisioning.sms.CRMProcessProcessSmsRunBean</ejb-class>
<session-type>Stateless</session-type>
</session>
...
<container-transaction>
<method>
<ejb-name>CRMProcessProcessSmsRunBean</ejb-name>
<method-name>*</method-name>
<method-intf>Local</method-intf>
</method>
<tx:trans-timeout>
<tx:timeout>86400</tx:timeout>
<tx:unit>Seconds</tx:unit>
</tx:trans-timeout>
</container-transaction>
...
|