Chapter 3 Service Endpoint Design
97
In Figure 3.8, the vertical lines represent the passage of time, from top to
bottom. The vertical rectangular boxes indicate when the entity (client or service) is
busy processing the request or waiting for the other entity to complete processing.
The half arrow type indicates asynchronous communication and the dashed vertical
line indicates that the entity is free to work on other things while a request is being
processed.
public class ReservationRequestRcvr {
public ReservationRequestRcvr() throws RemoteException {....}
public String receiveRequest(Source reservationDetails) throws
RemoteException, InvalidRequestException{
/** Validate incoming XML document **/
String xmlDoc = getDocumentAsString(reservationDetails);
if(!validDocument(xmlDoc))
throw new InvalidRequestException(...);
/** Get a JMS Queue and delegate the incoming request **/
/** to the queue **/
QueueConnectionFactory queueFactory =
serviceLocator.getQueueConnectionFactory(....);
Queue reservationRequestQueue =
serviceLocator.getQueue(...);
QueueConnection connection =
queueFactory.createQueueConnection();
QueueSession session = connection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
QueueSender queueSender = session.createSender(queue);
TextMessage message = session.createTextMessage();
message.setText(xmlDoc);
queueSender.send(message);
/** Generate and return a correlation identifier **/
return generateCorrelationID();
}
}
Code Example 3.16
Implementing Travel Agency Service Interaction
<
New Page 1
Web Hosting Apache