Java Extension Multithread Workshop:-Service Hooks in Java
1)Write a Multithread Routine To print Customer Name and Customer Id By using Hooks
Services in java
Services in T24
• Multithreaded processes
• Must implement com.temenos.t24.api.hook.system.ServiceLifecycle
• Equivalent of LOAD – initialize() SELECT – getIds() or getTableName() RECORD – process() or
inputRecord()
DEMO- Service Simple Service that displays the Customer ID and Customer Name, where the
Language should be “1”
Excepted Output:-
EB.API Record for BATCH.JOB.NAME
Create Project
Create Package
Create the class
And Write below java code
package com.multithread;
import java.util.List;
import com.temenos.t24.api.complex.eb.servicehook.ServiceData;
import com.temenos.t24.api.hook.system.ServiceLifecycle;
import com.temenos.t24.api.records.company.CompanyRecord;
import com.temenos.t24.api.records.customer.CustomerRecord;
import com.temenos.t24.api.system.DataAccess;
public class MultiService extends ServiceLifecycle {
DataAccess yDataAccess = new DataAccess(this);
@Override
public List<String> getIds(ServiceData serviceData, List<String>
controlList) {
// TODO Auto-generated method stub
CompanyRecord yCompRec = new CompanyRecord(this);
List<String> idList = null;
String yCompMne = yCompRec.getFinancialMne().getValue();
idList = yDataAccess.selectRecords(yCompMne, "CUSTOMER", "", "WITH
LANGUAGE EQ '1'" );
return idList;
}
@Override
public void initialise(ServiceData serviceData) {
// TODO Auto-generated method stub
System.out.println("Customer List");
}
@Override
public void process(String id, ServiceData serviceData, String
controlItem) {
// TODO Auto-generated method stub
String yCustId =id;
CustomerRecord yCustRec = new
CustomerRecord(yDataAccess.getRecord("CUSTOMER", yCustId));
String yCustName = yCustRec.getName1().toString();
System.out.println("Customer Id :" + yCustId );
System.out.println("Customer Name :" + yCustName );
}
}
• Create the JAR.
• Add the JAR to the jBoss module.xml and restart jBoss
EB.AP
SERVICE.DEMO.LOAD
I,
Make Entry in BATCH
Make Entry in TSS
Note: While running service – Service.Control should be Start
Run the Services