Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Implementing an Enterprise Service Bus in Java : Page 3

Using the open source Mule project, you can build a highly customized Enterprise Service Bus (ESB) that meets your specific needs.


advertisement
Primary Interfaces for a Simple HTTP ESB Using Mule
For the purposes of this article, I've used Mule as the messaging framework, but constructed the principal interfaces and classes that define the ESB from scratch. The first order of business is to define the interfaces for the ESB, as described in the following sections.

ESB
The ESB interface defines the contract for each ESB. The ESB interface exposes two simple methods: one (getAdministrator) for retrieving the global administration object and one (transmitMessage) for placing a message on the bus.

 
Figure 3. ESB Interfaces: The figure shows a static model class diagram of the relationships between the ESB interfaces.

public interface ESB { public Administrator getAdministrator(); public void transmitMessage(ServiceMessage message) throws MessageTransmissionException; }

Figure 3 shows a static model class diagram of the relationships between the ESB interfaces.

RuntimeEngine
The RuntimeEngine interface defines the contract for each runtime engine used by the ESB. Each ESB instance contains a RuntimeEngine that interacts between service requesters and service providers.

Each instance of the RuntimeEngine class is a processing unit that embodies the functionality of the ESB and directs service interactions between service requesters and service providers.

public interface RuntimeEngine { public Administrator getAdministrator(); public NamespaceDirectory getNamespaceDirectory(); public void transmitMessage(ServiceMessage message) throws MessageTransmissionException; }

The Mediator Interface
The Mediator interface defines the contract for a generic mediator. A mediator is responsible for acting upon (transforming, augmenting, and securing) a message before the message reaches its destination.



public interface Mediator { public void addMessageListener( ServiceMessageListener listener); public void removeMessageListener( ServiceMessageListener listener); /** * Associates a given Destination with * this Mediator * * @param destination the Destination */ public void setDestination( Destination destination); /** * Retrieves the Destination associated with * this Mediator * * @return <code>Destination</code> the Destination * associated with this Mediator */ public Destination getDestination(); /** * Transforms a given message. The transformed * message is returned. * * @param message the inbound message * @return <code>ServiceMessage</code> the * transformed message */ public ServiceMessage transform( ServiceMessage message) throws TransformMessageException; /** * routes a message based on content. * * @param message the inbound message */ public void route(ServiceMessage message) throws RouteMessageException; /** * Augments a given message. The augmented * message is returned. * * @param message the inbound message * @return <code>ServiceMessage</code> the * augmented message */ public ServiceMessage augment( ServiceMessage message) throws AugmentMessageException; /** * Secures a given message. The secured message * is returned. * * @param message the inbound message * @return <code>ServiceMessage</code> the * secured message */ public ServiceMessage secure( ServiceMessage message) throws SecureMessageException; }

NamespaceDirectory
The NamespaceDirectory interface defines the contract for an ESB namespace directory, letting you add and discover message destinations.

public interface NamespaceDirectory { public void addDestination(String namespace, Destination destination); public Destination getDestination( String namespace); }

SecurityProvider
The SecurityProvider interface handles security for each message-request including authentication, authorization, non-repudiation, confidentiality, and enforcement of security standards such as Kerberos and WS-Security.

public interface SecurityProvider { public void authenticateRequester( ServiceRequester requester) throws RequestSecurityException; public void authorizeRequest(ServiceRequester requester, ServiceMessage message, ServiceProvider provider) throws RequestSecurityException; public void logRequest(ServiceRequester requester, ServiceMessage message, ServiceProvider provider) throws RequestSecurityException; public ServiceMessage encryptRequest( ServiceRequester requester, ServiceMessage message, Destination destination) throws RequestSecurityException; public ServiceMessage decryptRequest( ServiceRequester requester, ServiceMessage message, Destination destination) throws RequestSecurityException; }



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap