©


Core J2EE Pattern Catalog

© CoreJ2EEPatterns
All Rights Reserved.

Last Updated:
January 29, 2006 8:54 PM

 

In Association with Amazon.com


Service Activator

See Core J2EE Patterns, 2nd Edition for full description of this pattern and its strategies.

Problem

You want to invoke services asynchronously.

Forces

  • You want to invoke business services, POJOs, or EJB components in an asynchronous manner.
  • You want to integrate publish/subscribe and point-to-point messaging to enable asynchronous processing services.
  • You want to perform a business task that is logically composed of several business tasks.

Solution

Use a Service Activator to receive asynchronous requests and invoke one or more business services.

Class Diagram

Sequence Diagram

Strategies

  • POJO Service Activator Strategy
  • MDB Service Activator Strategy
  • Service Activator Aggregator Strategy
  • Response Strategies
    • Database Response Strategy
    • Email Response Strategy
    • JMS Message Response Strategy

Consequences

  • Integrates JMS into enterprise applications
  • Provides asynchronous processing for any business-tier component
  • Enables standalone JMS listener

Related Patterns

  • Session Façade
    The Session Façade encapsulates the complexity of the system and provides coarse-grained access to business objects. A Service Activator can access a Session Façade as a business service to invoke business processing.
  • Application Services
    An Application Service can also be a kind of business service that a Service Activator invokes to process the request.
  • Business Delegate
    The Service Activator typically uses a Business Delegate to access a Session Façade. This results in simpler code for the Service Activator and results in Business Delegate reuse across different tiers.
  • Service Locator
    The client can use the Service Locator pattern to look up and create JMS-related service objects. The Service Activator can use the Service Locator pattern to look up and create enterprise bean components.
  • Half-Sync/Half-Async [POSA2]
    The Service Activator is related to the Half-Sync/Half-Async pattern. The pattern describes architectural decoupling by suggesting different layers for synchronous and asynchronous processing, and an intermediate queuing layer in between.
  • Aggregator [EIP]
    The Aggregator pattern discusses the problem of converting a request into several asynchronous tasks and aggregating the results. The Service Activator Aggregator strategy is based on similar concepts.
Contact Us © CoreJ2EEPatterns.com. All Rights Reserved. Terms of use