モジュールを含むコンポーネントは、WebSphere® ESB クラスターの任意のノード上でコンポーネントを使用することができます。
ServiceManager serviceManager = new ServiceManager();
InputStream myReferences = new FileInputStream("MyReferences.references"); ServiceManager serviceManager = new ServiceManager(myReferences);
StockQuote stockQuote = (StockQuote)serviceManager.locateService("stockQuote");
Service stockQuote = (Service)serviceManager.locateService("stockQuote");
public class MyValueImpl implements MyValue { public float myValue throws MyValueException { ServiceManager serviceManager = new ServiceManager(); // variables Customer customer = null; float quote = 0; float value = 0; // invoke CustomerInfo cInfo = (CustomerInfo)serviceManager.locateService("customerInfo"); customer = cInfo.getCustomerInfo(customerID); if (customer.getErrorMsg().equals("")) { // invoke StockQuote sQuote = (StockQuote)serviceManager.locateService("stockQuote"); Ticket ticket = sQuote.getQuote(customer.getSymbol()); // … do something else … quote = sQuote.getQuoteResponse(ticket, Service.WAIT); // assign value = quote * customer.getNumShares(); } else { // throw throw new MyValueException(customer.getErrorMsg()); } // reply return value; } }