Documente Academic
Documente Profesional
Documente Cultură
Middleware Technologies
BITS Pilani Ravi Kiran MALLIDI
Pilani|Dubai|Goa|Hyderabad Enterprise Architect
1
BITS Pilani
Pilani|Dubai|Goa|Hyderabad
Raise of
Machines
Raise of (REST, Cloud
Services (SOA, Services, MSA,
SOAP, REST, Serverless
Raise of ESB, BPM) Technologies)
Middleware’s
(MOM, EAI)
Raise Of
Frameworks
(RPC/RMI,
CORBA,
DCOM, EJB’s)
Raise Of
The Web
(TCP/IP,
IPC)
Middleware Concepts
CSI ZG524 Middleware Technologies 4
Types Middleware
Here are some of the most widely used types of middleware
• Remote Procedure Call (RPC) middleware provides a protocol that allows a program to
request a service from another program located on another computer or network.
• Object or ORB (Object Request Broker) middleware enables software components or
objects to communicate and interact with a programs, such as containers, across
distributed systems.
• Messaging (JMS) middleware facilitates communications between distributed
applications and services
• Data or database middleware enables direct access to, and interaction with, databases;
it typically includes SQL database software
• Transaction or transactional middleware ensures transactions move from one phase
to the next via transaction process monitoring.
• Content-centric middleware allows client-side requests for specific content and
abstracts and delivers it; it's similar to publish / subscribe middleware like Apache
Kafka.
• Embedded middleware facilitates communication and integration between embedded
apps and real-time operating systems 5
EAI Patterns
6
EAI Patterns
Bobby Woolf and Addison-Wesley documented a pattern language consisting of 65
integration patterns to establish a technology-independent vocabulary and a visual notation
to design and document integration solutions, ranging from
• connecting applications to a messaging system
• routing messages to the proper destination and
• monitoring the health of a messaging system.
The patterns are brought to life with examples implemented in messaging technologies,
such as JMS, SOAP, MSMQ, .NET, and other EAI Tools.
The solutions are relevant for a wide range of integration tools and platforms, such as IBM
WebSphere MQ, TIBCO, Vitria, WebMethods (Software AG), or Microsoft BizTalk,
messaging systems, such as JMS, WCF, Rabbit MQ, or MSMQ, ESB's such as Apache
Camel, Mule, WSO2, Oracle Service Bus, Open ESB, SonicMQ, Fiorano or Fuse
ServiceMix.
End Point
Application A Application B
A Point-to-Point Channel ensures that only one receiver consumes any given message. If
the channel has multiple receivers, only one of them can successfully consume a particular
message. The channel can still have multiple receivers to consume multiple messages
concurrently, but only a single receiver consumes any one message
It has one input channel that splits into multiple output channels, one for each subscriber.
When an event is published into the channel, the Publish-Subscribe Channel delivers a
copy of the message to each of the output channels..
The Dead Letter Channel works depends on the vendor specific implementation. channel
may be called a “dead message queue” or “dead letter queue” in MQSeries.
The Content-Based Router examines the message content and routes the message onto a
different channel based on data contained in the message. The Content-Based Router can
take on the form of a configurable rules engine that computes the destination channel
based on a set of configurable rules
Related Patterns: Dynamic Router, Message Filter, Invalid Message Channel, Message
Router, Pipes and Filters, Publish-Subscribe Channel, Routing Slip, Transactional Client
14
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Routing – Message
Filter
Message Filter is used to eliminate undesired messages from a channel based on a set of
criteria.
The Message Filter has only a single output channel. If the message content matches the
criteria specified by the Message Filter, the message is routed to the output channel. If the
message content does not match the criteria, the message is discarded
The Dynamic Router stores the 'preferences' for each participant in a rule base. When a
message arrives, the Dynamic Router evaluates all rules and routes the message to the
recipient whose rules are fulfilled. This allows for efficient, predictive routing without the
maintenance dependency of the Dynamic Router on each potential recipient
The logic embedded in a Recipient List can be pictured as two separate parts even though
the implementation is often coupled together. The first part computes a list of recipients. The
second part simply traverses the list and sends a copy of the received message to each
recipient. Just like a Content-Based Router, the Recipient List usually does not modify the
message contents
Splitter is used to consumes one message containing a list of repeating elements, each of
which can be processed individually. The Splitter publishes a one message for each single
element (or a subset of elements) from the original message
The Resequencer can receive a stream of messages that may not arrive in order. The
Resequencer contains in internal buffer to store out-of-sequence messages until a complete
sequence is obtained. The in-sequence messages are then published to the output channel
The Content Filter does not necessarily just remove data elements. A Content Filter is also
useful to simplify the structure of the message. Often times, messages are represented as
tree structures. Many messages originating from external systems or packaged applications
contain many levels of nested, repeating groups because they are modeled after generic,
normalized database structures
The Content Enricher uses information inside the incoming message (e.g. key fields) to
retrieve data from an external source. After the Content Enricher retrieves the required data
from the resource, it appends the data to the message. The original information from the
incoming message may be carried over into the resulting message or may no longer be
needed, depending on the specific needs of the receiving application
Related Patterns: Content Filter, Event Message, Message Channel, Message Translator,
Claim Check 23
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
BITS Pilani
Pilani|Dubai|Goa|Hyderabad
In 1996 the first report was published on SOA by the analysts Roy W.Schulte and Yefim
V.Natis
25
A manifesto was published for service-oriented architecture in October, 2009. This came up
with six core values which are listed as follows
• Business value is given more importance than technical strategy.
• Strategic goals are given more importance than project-specific benefits.
• Intrinsic inter-operability is given more importance than custom integration.
• Shared services are given more importance than specific-purpose implementations.
• Flexibility is given more importance than optimization.
• Evolutionary refinement is given more importance than pursuit of initial perfection.
SOA can be seen as part of the continuum which ranges from the older concept of
distributed computing and modular programming, through SOA, and on to current practices
of mashups, SaaS, and cloud computing. 26
28
Features:
• Uses interfaces which solves the difficult integration problems in large systems.
• Communicates customers, providers and suppliers with messages by using the
XML schema.
• Uses the message monitoring to improve the performance measurement and
detects the security attacks.
• Reuses the service, there will be lower software development and management
costs.
29
30
31
Component
Services
Security Business
Services Services
SOA Blueprint
32
View Layer
P Application Layer
r
o Work Flow Rules CEP B
g
A
r
M
a
Enterprise Service Bus (ESB)
m
s
33
34
Level-5
(Optimizing)
Level-4 • Associates with
(Managed) business
• Specifies the
Level-3 • Business activity endpoint of an
(Defined) monitoring architecture
functionality enterprise
Level-2 • Reuse of • Business process
(Repeatable) components • Interacts with
visibility services from
• Simple way of • Business process
Level-1 (Initial) • Low cost of modification customers,
delivery and service alerts partners and
• R&D • Changes the
experimentation • Low cost of business process others
maintenance
• Small SOA effectually
projects • Integration of • Providing
database
• Implementation business process
of portal and • Integration of rules
website application
• Process of • Managing the
custom performance
integration • Simple way of
• Number of deployment
services
36
• Schema Poisoning Attack - This attack when occurs, modifies, replaces or even
damages XML schemes that provides the structure of XML documents.
• Denial Of Service Attacks (DoS) - This attack when occurs, do not change the
service or its behavior but can block the use of the service.
37
39
40
41
43
45
46
48
• Infrastructure Services
o Implement tasks such as auditing, security, and logging
o Services are not unveiled to the outside world. :
50
SOA MSA
“share-as-much-as-possible” architecture approach “share-as-little-as-possible” architecture approach
Common governance and standards People, collaboration and freedom of other options
Multi-threaded with more overheads to handle I/O Single-threaded usually with the use of Event Loop
Traditional Relational Databases are more often Modern Relational Databases are more often used
used
A systematic change requires modifying the A systematic change is to create a new service
monolith
DevOps / Continuous Delivery is not a mainstream Strong focus on DevOps / Continuous Delivery
51
Services / API’s
Application Server
OS OS
Storage Storage
Network Network
52
DB DB
54
Java Script Frameworks (AngularJS etc.,) SPAs use JavaScript frameworks and HTML5 to create
fluid and responsive Web apps, without constant page
reloads. This means much of the work happens on the
REST / SOAP Service Layer
client side, in JavaScript.
Persistence Layer – JDBC, Hibernate etc., The REST services interact with Business layer for
business operations
Storage Layer (Database) The Storage Layer retains important data into relational
database system like MySQL, Oracle, or SQL Server
DB DB
55
56
SOA Layout
57
SOA Layout
58
Implementation Services
• Implementation services close the gap between business service and a concrete service
provider (application, system). This type of service converts such a component to a usable unit
in the context of SOA.
• This is a rather complex task in the case of so-called “legacy applications” which simply were
not designed to work with other systems in the way needed. Most of the time these systems
offer interfaces which are however not readily useable in an SOA environment.
59
NoSQL Databases
60
NoSQL Database
NoSQL databases are built for specific data models and have flexible schemas for building
modern applications.
NoSQL databases are widely recognized for their ease of development, functionality, and
performance at scale.
They use a variety of data models, including document, graph, key-value, in-memory, and
search. This page includes resources to help you better understand NoSQL databases and
to get started.
The predominant data model that was used for application development was the relational
data model used by relational databases such as Oracle, DB2, SQL Server, MySQL, and
PostgreSQL. It wasn’t until the mid to late 2000s that other data models began to gain
significant adoption and usage. To differentiate and categorize these new classes of
databases and data models, the term “NoSQL” was coined. Often the term “NoSQL” is used
interchangeably with “nonrelational.”
61
Consider the example of modeling the schema for a simple book database:
• In a relational database, a book record is often dissembled (or “normalized”) and stored
in separate tables, and relationships are defined by primary and foreign key constraints.
o For Example, the Books table has columns for Book ID, Book Title, and Edition
Number, the Authors table has columns for Author ID and Author Name, and finally
the Author-ISBN table has columns for Author ID and Book ID. The relational model
is designed to enable the database to enforce referential integrity between tables in
the database, normalized to reduce the redundancy, and generally optimized for
storage.
• In a NoSQL database, a book record is usually stored as a JSON document.
o For each book, the item, Book ID, Book Title, Edition Number, Author Name, and
Author ID are stored as attributes in a single document. In this model, data is
62
optimized for intuitive development and horizontal scalability.
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
NoSQL Database Advantages
NoSQL databases are a great fit for many modern applications such as mobile, web, and
gaming that require flexible, scalable, high-performance, and highly functional databases to
provide great user experiences.
• Flexibility - NoSQL databases provide flexible schemas that enable faster and
more iterative development. The flexible data model makes NoSQL databases ideal
for semi-structured and unstructured data.
• Scalability - NoSQL databases are designed to scale out by using distributed
clusters of hardware instead of scaling up by adding expensive and robust servers.
Some cloud providers handle these operations behind-the-scenes as a fully
managed service.
• High-performance - NoSQL database are optimized for specific data models (such
as document, key-value, and graph) and access patterns that enable higher
performance than trying to accomplish similar functionality with relational
databases.
• Highly functional - NoSQL databases provide highly functional APIs and data
types that are purpose built for each of their respective data models.
63
Document - Developers do not think of their data model in terms of denormalized rows and
columns. Typically, in the application tier, data is represented as a JSON document because
it is more intuitive for developers to think of their data model as a document.
The popularity of document databases has grown because developers can persist data in a
database by using the same document model format that they use in their application code.
DynamoDB and MongoDB are popular document databases that provide powerful and
intuitive APIs for flexible and agile development.
64
In-memory - Gaming and ad-tech applications have use cases such as leaderboards,
session stores, and real-time analytics that require microsecond response times and can
have large spikes in traffic coming at any time. Amazon Elasti Cache offers Memcached
and Redis, to serve low-latency, high-throughput workloads, such as McDonald’s, that
cannot be served with disk-based data stores. Amazon DynamoDB Accelerator (DAX) is
another example of a purpose-built data store. DAX makes DynamoDB reads an order of
magnitude faster.
65
66
68
69
70
71
CAP Theorem
72
CAP Theorem (Brewer’s
Theorem)
CAP theorem states that there are three basic requirements which exist in a special relation
when designing applications for a distributed architecture.
• Consistency – The data in the database remains consistent after the execution of
an operation. For example after an update operation all clients see the same data.
• Availability - The system is always on (service guarantee availability), no
downtime.
• Partition Tolerance - The system continues to function even the communication
among the servers is unreliable, i.e. the servers may be partitioned into multiple
groups that cannot communicate with one another.
In theoretically it is impossible to fulfill all 3 requirements. CAP provides the basic
requirements for a distributed system to follow 2 of the 3 requirements. Therefore all the
current NoSQL database follow the different combinations of the C, A, P from the CAP
theorem. Here is the brief description of three combinations CA, CP, AP :
• CA - Single site cluster, therefore all nodes are always in contact. When a partition
occurs, the system blocks.
• CP -Some data may not be accessible, but the rest is still consistent/accurate.
• AP - System is still available under partitioning, but some of the data returned may
be inaccurate. 73
74
MongoDB
75
MongoDB
MongoDB is an open-source document database and leading NoSQL database. MongoDB
is written in C++.
MongoDB is a cross-platform, document oriented database that provides, high
performance, high availability, and easy scalability. MongoDB works on concept of collection
and document
• Collection is a group of MongoDB documents. It is the equivalent of an RDBMS
table. A collection exists within a single database. Collections do not enforce a
schema. Documents within a collection can have different fields. Typically, all
documents in a collection are of similar or related purpose
• A document is a set of key-value pairs. Documents have dynamic schema.
Dynamic schema means that documents in the same collection do not need to
have the same set of fields or structure, and common fields in a collection's
documents may hold different types of data.
Database is a physical container for collections. Each database gets its own set of files on
the file system. A single MongoDB server typically has multiple databases
76
77
78
Caching
79
Caching
In computing, a cache is a high-speed data storage layer which stores a subset of data,
typically transient in nature, so that future requests for that data are served up faster than is
possible by accessing the data’s primary storage location. Caching allows you to efficiently
reuse previously retrieved or computed data.
The data in a cache is generally stored in fast access hardware such as RAM (Random-
access memory) and may also be used in correlation with a software component. A cache's
primary purpose is to increase data retrieval performance by reducing the need to access
the underlying slower storage layer.
Trading off capacity for speed, a cache typically stores a subset of data transiently, in
contrast to databases whose data is usually complete and durable.
80
81
Mobile / Desktops
83
Reduce Database Cost - A single cache instance can provide hundreds of thousands of
IOPS (Input/output operations per second), potentially replacing a number of database
instances, thus driving the total cost down. This is especially significant if the primary
database charges per throughput. In those cases the price savings could be dozens of
percentage points.
84
Reduce the Load on the Backend - By redirecting significant parts of the read load from
the backend database to the in-memory layer, caching can reduce the load on your
database, and protect it from slower performance under load, or even from crashing at
times of spikes
Increase Read Throughput (IOPS) - Lower latency, in-memory systems offer much higher
request rates (IOPS) relative to a comparable disk-based database. A single instance used
as a distributed side-cache can serve hundreds of thousands of requests per second
85
Process needs some data, it first searches in the cache memory. If the data is available in
the cache, this is termed as a cache hit and the data is accessed as required. If the data is
not in the cache then it is termed as a cache miss. Then the data is obtained from the main
memory. After that the data is transferred to the cache memory under the assumption that it
will be needed again.
The performance of the cache is measured using the hit ratio. It is the number of cache hits
divided by the total cache accesses. The formula for this is:
86
Primary Cache - Primary cache is very fast and its access time is similar to the processor
registers. This is because it is built onto the processor chip. However because of this
reason, its size is quite small. It is also known as a level 1 cache and is build using static
RAM (SRAM).
Secondary Cache - The secondary cache or external cache is cache memory that is
external to the primary cache. It is located between the primary cache and the main
memory. It is also known as a level 2 cache and is often housed on the processor chip as
well.
87
Ehcache was developed by Greg Luck starting in 2003. In 2009, the project was purchased
by Terracotta (provides paid support).
Ehcache can be configured with multiple frameworks and ORM tools like Hibernate.
Alternatives of Ehcache:
• Terracotta
• Hazelcast
• Memcached
• Couchbase Server 88
89
Memcached:
When an object is added to cache, the
Memcached client will take that object,
serialize it, and send a byte array to the
Memcached server for storage
if application is running on more than one
application server, all of them can point to
the same Memcached server and use it for
getting and setting cache entries
90
Disadvantages:
• Applications need to be designed with Memcached support in mind
• It’s volatile memory and shouldn’t be used to store anything that you can’t repopulate from
a persistent source (like the file system or a database)
• It’s yet another process running on the server.
• No means of authentication making data insecure
• Memcached works as an external service which means that externally needs to be
91
installed / run in production environment
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Caching – Apache Camel
The Ehcache component enables the applications to perform caching operations using
Ehcache 3 as the Cache Implementation. This component supports producer and event
based consumer endpoints. The Cache consumer is an event based consumer and can be
used to listen and respond to specific cache activities.
Another way of Camel application caching with most powerful and secure way was JMS
replication.
92
Cloud
93
Cloud Basics
Cloud computing is shared pools of configurable computer system resources and higher-
level services that can be rapidly provisioned with minimal management effort, often over
the Internet.
Cloud computing relies on sharing of resources to achieve coherence and economies of
scale, similar to a public utility
Cloud Computing refers to manipulating, configuring, and accessing the hardware and
software resources remotely. Offers online data storage, infrastructure, and application.
Cloud computing offers platform independency, as the software is not required to be
installed locally on the PC. Hence, the Cloud Computing is making our business
applications mobile and collaborative
Following are the working models for cloud computing:
• Deployment Models
• Service Models
94
PUBLIC CLOUD - The public cloud allows systems and services to be easily accessible to
the general public. Public cloud may be less secure because of its openness.
PRIVATE CLOUD - The private cloud allows systems and services to be accessible within
an organization. It is more secured because of its private nature.
COMMUNITY CLOUD - The community cloud allows systems and services to be accessible
by a group of organizations.
HYBRID CLOUD - The hybrid cloud is a mixture of public and private cloud, in which the
critical activities are performed using private cloud while the non-critical activities are
performed using public cloud.
95
IaaS
INFRASTRUCTURE-AS-A-SERVICE (IAAS) - IaaS provides
access to fundamental resources such as physical machines,
virtual machines, virtual storage, etc. Service
Models
Cloud
Computing
97
98
Technical - Cloud service providers offer services to number of clients each day,
Sometimes the system can have some serious issues leading to business processes
temporarily being suspended. Additionally, if the internet connection is offline then we will
not be able to access any of the applications, server, or data from the cloud.
Not Easy to Switch Service Providers - Cloud service providers promises vendors that
the cloud will be flexible to use and integrate, however switching cloud services is not easy.
Most organizations may find it difficult to host and integrate current cloud applications on
another platform. Interoperability and support issues may arise such as applications
developed on Linux platform may not work properly on Microsoft Development Framework
100
Integration Platform
102
Grid Computing breaks complex task into smaller pieces, which are distributed to CPUs that
reside within the grid
Grid Computing
Laptops
Servers 103
Utility Computing - Utility computing is the process of providing service through an on-
demand, pay per use billing method. It offers computational resources on demand as a
metered service. Cloud computing, grid computing, and managed IT services are based on
the concept of utility computing.
104
AppScale The AppScale is an open source platform for App Engine of Google applications.
The AT&T allows access to virtual servers and manages the virtualization infrastructure. This
AT&T
virtualization infrastructure includes network, server and storage.
The FlexiScale offers a cloud computing platform that allows flexible, scalable and automated cloud
FlexiScale
infrastructure
The Google's App Engine lets the users build, run and maintain their applications on Google
Google
infrastructure.
The Microsoft Windows Azure is a cloud computing platform offering an environment to create cloud
Microsoft
apps and services.
RackSpace The RackSpace provides servers-on-demand via a cloud-driven platform of virtualized servers.
The Amazon EC2 (Elastic Compute Cloud) lets the users configure and control computing resources
Amazon EC2
while running them on Amazon environment.
CloudHub is the platform as a service (PaaS) component of Anypoint Platform, providing a fully-
CloudHub managed, multi-tenanted, globally available, secure and highly available cloud platform for integration
and APIs
107
109
110
AWS LAMBDA
111
AWS Lambda
AWS Lambda is a responsive cloud service that inspects actions within the application and
responds by deploying the user-defined codes, known as functions. It automatically
manages the compute resources across multiple availability zones and scales them when
new actions are triggered.
AWS Lambda supports the code written in Java, Python and Node.js, and the service can
launch processes in languages supported by Amazon Linux (includes Bash, Go & Ruby).
AWS Lambda is an event-driven, serverless computing platform as a part of the Amazon
Web Services. It is a computing service that runs code in response to events and
automatically manages the computing resources required by that code.
The purpose of Lambda, as compared to AWS EC2, is to simplify building smaller, on-
demand applications that are responsive to events and new information.
Following are some recommended tips while using AWS Lambda.
• Write Lambda function code in a stateless style.
• Never declare any function variable outside the scope of the handler.
• Set of +rx permissions on files in the uploaded ZIP to ensure Lambda can execute
code.
• Delete old Lambda functions when no longer required 112
113
114
115
116
118
119
Solution
• A loan broker is typically not affiliated with any one bank but has access to many lending
institutions
• The broker gathers the customer data once and contacts the credit agency to obtain the
customer's credit history
• Based on the credit score and history, the broker presents the request to a number of
banks that are best suited to meet the customer’s criteria.
• The broker gathers the resulting quotes from the banks and selects the best offer (i.e.
the lowest interest rate) to pass back to the consumer.
Insurance
Customer Insurance
Insurance broker collates
requests Broker
broker sends the quotes,
insurance requests
customer info provides the
broker for Insurance Org
to get profile customer the
quote for quotes
lowest quote
120
Insurance Broker
4. Get Bank
2. Get Customer
Quote
Profile
Credit
Agency( Bank Bank
JMS) 1(JMS Bank 3(JMS
service) 2(JMS service)
service)
121
Bank Bank 1
Http Services
Client
Bank 2
Bank
1. Receive Agency
Loan
Request 3. Get Banks List
Loan
Broker Bank 3
122
124
Build
You will need to compile this example first:
mvn compile
Run
mvn exec:java -PWS.LoanBroker
mvn exec:java -PWS.Client
125
Overview
• Recommends a Middleware solution which is cost effective, maintainable and future
ready
• Utilizes existing Service s exposed by the existing application can be consumed in
middleware
Scope
• A total of 08 interfaces have been identified for the current scope between PO,
ECC, CRM, SAP-BW and iPrice
• Using Apache Camel as the Middleware solution for integration between systems 127
128
AS - IS TO - BE
CRM iPrice
Middleware
(Apache Connectivity Services
Component Services
Routing Orchestration
Business Services
Provisioning Mapping
ECC SAP-BW
129
130
Apache ActiveMQ - A fast, AMQP (Advanced Message WebSphere MQ - IBM’s Oracle Message Broker - A
open source message broker Queuing Protocol): Support is implementation of the JMS JMS-compliant API supports
that supports JMS based on the RabbitMQ Java interfaces AQ, IBM MQSeries, TIBCo
Client Rendezvous, and more
Apache Camel - An open Routing/EIPs - Content-based
source framework that provides Routers - MuleSoft uses routing and other enterprise Routing Service - SOA style
implementations of tried and routers to split, combine, integration patterns can be routing services allows for
true EIPS (Enterprise reorder, evaluate, and implemented via the use of routing rules to be defined and
Integration Patterns). broadcast messages XSLT published with a WSDL
Apache CFX - An open source Anypoint Connectors - Pre- WebSphere Adapters - Pre- Integration Adapters - A set
web services framework, which built protocol, database, built protocol, database, of JCA adapters available for
provides for communication transport, and database transport, and database download.
using various standards such connectors. connectors
ESB Server - The runtime
as JAX-WS and JAX-RS
Mule Runtime Engine - The WebSphere Application server that listens to topics for
Apache Karaf - An OSGI heart of the MuleSoft Anypoint Server - The runtime of updates
runtime container for deploying platform. Deployable in the WebSphere ESB is built on top
ESB Control - Allows
applications cloud or on premise of WAS
configuration changes to be
Fabric8 - An orchestration tool Mule Runtime Manager - Administrative Console - A made in real time
for large middleware Allows for the deployment, browser-based interface that
deployments monitoring, and that allows to monitor, update,
troubleshooting of Mule start and stop applications,
instances services, and resources
running on WebSphere ESB
132
133