1. Home
  2. Training Library
  3. Programming
  4. Programming Courses
  5. Using Design Patterns in Java Projects

Service Activator

Contents

keyboard_tab
Design Patterns
1
Design Patterns
PREVIEW2m 26s
2
Singleton Pattern
PREVIEW3m 13s
9
Decorator
7m 48s
10
Flyweight
9m 20s
11
Proxy
7m 36s
12
Facade
6m 5s
14
Command
11m 44s
15
Iterator
8m 24s
16
Visitor
9m 4s
17
Mediator
11m 38s
18
Memento
9m 48s
19
Observer
10m 40s
20
Strategy
8m 27s
21
State
10m 27s
22
Template
7m 56s
23
MVC
10m 27s
26
DAO
10m 27s
27

The course is part of this learning path

Start course
Overview
Difficulty
Intermediate
Duration
4h 56m
Students
22
Ratings
5/5
starstarstarstarstar
Description

This course takes an in-depth look at how to use design patterns in your Java projects. We will then run through some example questions of what you could expect from the Oracle Certified Java EE exam.

Learning Objectives

  • Understand what design patterns are
  • Learn about the myriad of design patterns that you can use in your projects

Intended Audience

This course is intended for anyone who already has basic knowledge of Java and now wants to learn about Java EE 6.

Prerequisites

Basic knowledge of Java programming.

 

Transcript

Hello dear friends. In this video, we will examine the service activator pattern. Let's begin. Before we begin, I'd like to make it clear that we cannot provide examples for all of these patterns. For instance, the service activator pattern requires a large structure which will be difficult to demonstrate in this course. As a result, I will only provide examples of patterns that can be implemented with small projects. Let's get going. In enterprise applications, a majority of the processing is done in a synchronous manner. A client invokes a business service and waits until the business service returns from processing. However, the business processing in some use cases takes considerable time and resources. The business processing might even span applications possibly integrating with applications inside and outside the enterprise. For these long lived processes, it's not feasible for application clients to wait until the business processing completes. So, in this case, we want to invoke services asynchronously.

Some long running use cases take a long time. Instead of blocking the users, we can run these asynchronously. JMS is a good example of service activator pattern. JMS as a Java message service is an API that provides the facility to create, send, and read messages. It provides loosely coupled, reliable, and asynchronous communication. Let's examine the UML of service activator. The client is any client in the application that needs to invoke a business service in an asynchronous manner. The client can be any type of application components such as POJO or an EJB component that can create and send JMS messages. The request is the message object created by the client and sent to the service activator using the message-oriented middleware. According to the JMS specification, the request object must implement the java.jms.message interface. The JMS API provides several message types such as text message, object message and so on that can be used as request objects depending on what type of message you want to send. The service activator is the main class of the pattern. It implements the javax.jms.MessageListener interface which is defined by the JMS specification.

The service activator implements an on-message method that is invoked when a new message arrives. The service activator parses the message to determine what needs to be done. The service activator might use a service locator to lookup or create business service components. The business service is the target object that the client asks to do asynchronous processing. The response is a message object created and sent either by the service activator or a business service. The response can be an acknowledgement to let the client know that the request was received. The response can also be the result of asynchronous processing. Now, I believe that covers the service activator pattern in JMS. In the next video, we will look into the DAO pattern. See you in the next video.

 

About the Author
Students
433
Courses
47
Learning Paths
2

OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.

Covered Topics