1 37 38 package com.sun.j2ee.blueprints.opc.webservicebroker.requestor; 39 40 import javax.jms.*; 41 import javax.ejb.*; 42 43 import com.sun.j2ee.blueprints.opc.JNDINames; 44 45 public class BrokerRequestorBean implements 46 MessageDrivenBean, MessageListener { 47 48 private MessageDrivenContext context; 49 50 public void setMessageDrivenContext(MessageDrivenContext context) { 51 this.context=context; 52 } 53 54 public void ejbCreate() {} 55 56 public void onMessage(Message message) { 57 WSClient target = null; 58 59 try { 60 String docType = message.getStringProperty(JNDINames.DOC_TYPE); 63 64 if(docType.equals(JNDINames.ACTIVITY_ORDER)) 66 target = WSClientFactory.getWSClient(JNDINames.ACTIVITY_SUPPLIER_CLIENT); 67 else if(docType.equals(JNDINames.LODGING_ORDER)) 68 target = WSClientFactory.getWSClient(JNDINames.LODGING_SUPPLIER_CLIENT); 69 else if(docType.equals(JNDINames.AIRLINE_ORDER)) 70 target = WSClientFactory.getWSClient(JNDINames.AIRLINE_SUPPLIER_CLIENT); 71 72 if(target != null) { 74 TextMessage msg = (TextMessage) message; 75 String po = msg.getText(); 76 String retVal = target.sendRequest(po); 77 } 78 } catch (JMSException jex) { 79 throw new EJBException(jex); 80 } 81 } 82 83 public void ejbRemove() {} 84 } 85 86 | Popular Tags |