SlideShare a Scribd company logo
www.luxoft.com
EVENT-DRIVEN ARCHITECTURE
WITH JAVA TECHNOLOGY STACK
Evgeniy Khyst
29.10.2015
www.luxoft.com
Event-Driven Architecture with Java Technology Stack
1. Event-Driven Architecture
2. Using Events in Java EE CDI Applications
3. Message-Oriented Middleware
4. Java Message Service
5. Message Queue and Publish-Subscribe Patterns
6. Reliable Message Delivery
7. Message Priority and Scheduled Delivery
8. Distributed Transactions
www.luxoft.com
Why Do We Need Event-Driven Architecture?
Let’s consider checkout shopping cart functionality for e-commerce framework.
public void checkoutShoppingCart(ShoppingOrder order) {
persistInDatabase(order);
sendEmailNotification(order);
shipToTheNearestWarehouse(order);
scheduleShippingToCustomer(order);
exportToERP(order);
}
Method checkoutShoppingCart becomes unmaintainable mess.
www.luxoft.com
Why Do We Need Event-Driven Architecture?
• The growing complexity of enterprise applications often result in bad
architecture, and organization is spending more and more money
building IT systems;
• Event-driven architecture is designed to solve these problems by
decoupling software components and services.
www.luxoft.com
Why Do We Need Event-Driven Architecture?
The goal of event-driven architecture is to allow to loosely couple
system components together.
www.luxoft.com
What Is Event?
• Event is a significant change in state;
• Events are transmitted among loosely coupled services;
• Events represent milestones in business process;
• Services observe events and react on them.
www.luxoft.com
Observer Pattern
• Observer pattern helps to understand event-driven architecture concepts;
• In observer pattern an object, called the subject, maintains a list of its dependents, called
observers, and notifies them of any state changes;
• Making use of events and observers makes services even more loosely coupled.
www.luxoft.com
Loose Coupling
• Components are loosely coupled if they have little or no direct knowledge
of each other;
• Coupling refers to classes, interfaces, services, software components;
• When a dependent class contains a pointer directly to a concrete class
which provides the required behavior, they are tightly coupled;
• When events and observers are used, class firing the event has no
knowledge of class observing and reacting on this event.
www.luxoft.com
Performance
• Designing systems to be asynchronous from end-to-end allows to
minimize the amount of threads blocking on IO operations, and to
use network bandwidth to its full capacity;
• All observers will react in parallel on notification about event,
making multi-core CPUs and clusters work on its highest capacity;
• When distributed system runs in cluster, events can be delivered to
any host of the cluster providing transparent load-balancing and
failover.
www.luxoft.com
Performance
Event-driven architecture allows to create much higher performance
applications.
www.luxoft.com
Using Events in Java EE CDI Applications
ShoppingOrderEvent bean defines an event using properties, which
has setter and getter methods.
private ShoppingOrder order;
...
public ShoppingOrderEvent() {
}
www.luxoft.com
Using Events in Java EE CDI Applications
Events are handled using an observer method.
public void persistInDatabase(@Observes ShoppingOrderEvent event) {
...
}
public void sendEmailNotification(@Observes ShoppingOrderEvent event) {
...
}
public void shipToTheNearestWarehouse(@Observes ShoppingOrderEvent event) {
...
}
public void scheduleShippingToCustomer(@Observes ShoppingOrderEvent event) {
...
}
public void exportToERP(@Observes ShoppingOrderEvent event) {
...
}
www.luxoft.com
Using Events in Java EE CDI Applications
To fire an event and notify any observer method, call the
javax.enterprise.event.Event.fire method.
@Inject
private Event<ShoppingOrderEvent> orderEvent;
public void checkoutShoppingCart(ShoppingOrder order) {
ShoppingOrderEvent orderEventPayload =
new ShoppingOrderEvent();
...
orderEvent.fire(orderEventPayload);
}
www.luxoft.com
Using Events in Java EE CDI Applications
• Each observer method as well as method firing event can be located
in different classes and packages;
• The senders and consumers of messages are completely
independent and know nothing of each other;
• Maximum loose coupling is achieved.
www.luxoft.com
Message-Oriented Middleware
• Events can be presented as messages;
• Message-oriented middleware (MOM) is software supporting sending
and receiving messages between distributed systems;
• MOM is sometimes called messaging system or message broker and
is an extra component in the architecture.
www.luxoft.com
Message-Oriented Middleware
Messaging systems usually provide protocol or API for sending and
receiving messages:
• JMS - Java Message Service
• AMQP - Advanced Message Queuing Protocol
• STOMP - Simple Text Oriented Messaging Protocol
• RESTful API
• System specific APIs
www.luxoft.com
Message-Oriented Middleware
Messaging systems usually support two styles of asynchronous
messaging:
• Point-to-Point
• Publish-Subscribe
www.luxoft.com
Java Message Service
• Java Message Service (JMS) is a standard of middleware for
sending messages, that allows applications, running on Java EE
platform, to create, send, receive and read messages;
• JMS is a Java API, part of Java EE specification.
www.luxoft.com
JMS 2.0 Example
Sending messages using JMS.
@Resource(mappedName =
"java:jboss/jms/queue/exampleQueue")
private Queue exampleQueue;
@Inject
private JMSContext context;
...
public void sendMessage(String text) {
context.createProducer().send(exampleQueue, text);
}
www.luxoft.com
JMS 2.0 Example
Synchronous receiving messages using JMS.
@Resource(mappedName =
"java:jboss/jms/queue/exampleQueue")
private Queue exampleQueue;
@Inject
private JMSContext context;
...
public String receiveMessage() {
return context.createConsumer(exampleQueue)
.receiveBody(String.class);
}
www.luxoft.com
Message-Driven Bean Example
Receiving messages with message-driven bean (MDB) an EJB that allows Java EE applications to process messages asynchronously.
@MessageDriven(name = "ExampleMDB", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationLookup",
propertyValue = "java:jboss/jms/queue/exampleQueue"),
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge")})
public class ExampleMDB implements MessageListener {
public void onMessage(Message message) {
try {
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
...
}
} catch (JMSException e) {
throw new RuntimeException(e);
}
}
}
www.luxoft.com
Message Queue Pattern
1. Message is sent to queue;
2. Message is persisted to provide a guarantee of delivery;
3. Messaging system delivers the message to a consumer;
4. Consumer processes and acknowledges the message;
5. Message is removed from the queue and is not available to be delivered
again;
6. If the system crashes before the messaging server receives an
acknowledgement from the consumer, then on recovery, the message will
be delivered to a consumer again.
www.luxoft.com
Publish-Subscribe Pattern
• Message is sent to topic;
• Each subscription receives a copy of each message sent to the
topic;
• Durable subscriptions receives all messages sent to the topic even
if consumer was not available for some time;
• Non durable subscriptions receives only those messages, that were
sent while consumer was available.
www.luxoft.com
Reliable Message Delivery
Message delivery occurs in two hops:
• the first hop takes the message from the producer to a physical
destination on the broker
• the second hop takes the message from that destination to the
consumer
www.luxoft.com
Reliable Message Delivery
A message can be lost in one of three ways:
• on its hop from the producer to the broker
• on its hop from the broker to the consumer
• while it’s in broker memory (if the broker fails)
Reliable delivery guarantees that delivery will not fail in any of these
ways.
www.luxoft.com
Reliable Message Delivery
Two mechanisms are used to ensure reliable delivery:
• acknowledgments or transactions are used to make sure
message was successfully consumed
• messaging system stores messages in a persistent store called
journal so that if the broker fails before the message is consumed,
the stored copy of the message can be redelivered on recovery
www.luxoft.com
Reliable Message Delivery
Messages are either durable or non-durable.
• Durable messages will be persisted in permanent storage and will
survive server failure or restart;
• Non durable messages will not survive server failure or restart.
www.luxoft.com
Message Redelivery
• Messages can be delivered unsuccessfully (if the broker fails);
• Such a message goes back to the JMS destination ready to be
redelivered.
www.luxoft.com
Message Redelivery
• To prevent clogging the system with messages that are delivered
again and again without success, messaging systems define dead
letter concept;
• After a specified unsuccessful delivery attempts, the message is
removed from the destination and put instead in a dead letter
queue.
www.luxoft.com
Message Redelivery
• Messaging systems also defines delayed redelivery concept;
• Redelivery will be scheduled with a delay;
• Delay between delivery attempts can increase exponentially.
www.luxoft.com
Message Expiration
• The time messages are retained in messaging system before it will
be removed can be limited;
• JMS providers set JMSExpiration field when a message is sent;
• When messages are expired, they are removed from the queue and
sent to the expiry queue.
www.luxoft.com
Message Priority
• By default messaging system queues operates as FIFO queues;
• Explicitly specifying message priority will make messaging queue operate
as priority queue;
• Message priority can be used to influence the delivery order for
messages;
• The message priority value is of type integer, ranging from 0 (the lowest) to
9 (the highest);
• Messages of higher priorities will likely be delivered before those of lower
priorities.
www.luxoft.com
Message Priority
• If business process can be decomposed into set of tasks
or activities, message priority can be used to interrupt
low priority business processes if higher priority business
process was started;
• High priority requests will be processed as fast as possible
and low priority requests will be processed when there will
be free computing resources.
www.luxoft.com
Message Priority
1. Send message with appropriate priority to the queue to start business
process;
2. Service consuming the message should perform corresponding activity and
at the end send another message into the queue propagating initial priority
to proceed business process;
3. If there are messages with higher priorities in the queue and there are not
enough computing resources, messages with higher priorities will be
processed first and after that messages with lower priority;
4. Business process with lower priority will be “interrupted” to let higher priority
business process complete.
www.luxoft.com
Scheduled Delivery
Most messaging systems provide a way to schedule message delivery.
This feature will be useful when:
• Business process should not be started immediately after message
was sent;
• Business process should be cancelled after some timeout.
www.luxoft.com
Scheduled Delivery
HornetQ example of scheduled delivery.
...
TextMessage message = session.createTextMessage(
"This is a scheduled message message which will be delivered in 5 sec.");
message.setLongProperty("_HQ_SCHED_DELIVERY", System.currentTimeMillis() + 5000);
producer.send(message);
...
// message will not be received immediately but 5 seconds later
TextMessage messageReceived = (TextMessage) consumer.receive();
...
www.luxoft.com
Distributed Transactions
• The JMS specification supports distributed transactions;
• The production and consumption of messages can be part of a
larger, distributed transaction that includes operations involving
other resource managers, such as database systems;
• A distributed transaction manager, like the one supplied by the
application server, must be available to support distributed
transactions.
www.luxoft.com
Two-Phase Commit
• Distributed transactions with two-phase commit (2PC) are also
called XA transactions;
• Support for distributed transactions means that messaging clients
can participate in distributed transactions through the XAResource
interface defined by JTA;
• This interface defines a number of methods used in implementing
two-phase commit.
www.luxoft.com
Two-Phase Commit
• Phase 1 - Prepare. Transaction coordinator, asks participating resources to
promise to commit or rollback the transaction. If any resource cannot
prepare, the transaction is rolled back;
• Phase 2 - Commit or Rollback. If all participants respond to the
coordinator that they are prepared, then the coordinator asks all resources
to commit the transaction.
2PC is done automatically by transaction manager (typically a part of Java EE
application server) and requires no actions from developer.
www.luxoft.com
Best Effort One-Phase Commit
The best efforts 1PC pattern is synchronized single-phase commit of a number of
resources.
The message transaction is started before the database one, and they end (either commit or
rollback) in reverse order.
1. Start messaging transaction
2. Receive message
3. Start database transaction
4. Update database
5. Commit database transaction
6. Commit messaging transaction
www.luxoft.com
Best Effort One-Phase Commit
• If the commit of the database resource fails, messaging transaction
will be rolled back;
• If the commit of the database resource success but the commit of
the messaging transaction fails, it will result in duplicate message
(message will be redelivered);
• Best effort 1PC commit can be used if system is able to
appropriately handle duplicate messages.
www.luxoft.com
Best Effort One-Phase Commit
Best effort 1PC example in Spring.
<bean id="nonTransactionalConnectionFactory"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="hornetQConnectionFactory"/>
<property name="username" value="guest"/>
<property name="password" value="guest"/>
</bean>
<bean id="connectionFactory"
class="org.springframework.jms.connection.TransactionAwareConnectionFactoryProxy">
<property name="targetConnectionFactory"
ref="nonTransactionalConnectionFactory"/>
<property name="synchedLocalTransactionAllowed" value="true"/>
</bean>
...
www.luxoft.com
Best Effort One-Phase Commit
...
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<constructor-arg ref="dataSource"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
...
www.luxoft.com
Best Effort One-Phase Commit
...
<jms:listener-container connection-factory="connectionFactory"
transaction-manager="transactionManager"
concurrency="10">
<jms:listener destination="exampleQueue" ref="myListener"/>
</jms:listener-container>
...
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="sessionTransacted" ref="true"/>
</bean>
...
www.luxoft.com
Transactions and Redelivery
• It is a common practice to rely on message redelivery in case of
distributed transaction failure;
• If it is acceptable for business process to be repeated, exception
handling in code can be skipped;
• Whole distributed transaction can be rolled back, message will be
returned to queue and delivered to available consumer to be
processed again.
www.luxoft.com
THANK YOU

More Related Content

What's hot

IBM Websphere MQ Basic
IBM Websphere MQ BasicIBM Websphere MQ Basic
IBM Websphere MQ BasicPRASAD BHATKAR
 
[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues
Naukri.com
 
Introduction to NServiceBus
Introduction to NServiceBusIntroduction to NServiceBus
Introduction to NServiceBus
Espen Ekvang
 
19 08-22 introduction to activeMQ
19 08-22 introduction to activeMQ19 08-22 introduction to activeMQ
19 08-22 introduction to activeMQ
Woo Young Choi
 
Secure Your Messages with IBM MQ Advanced Message Security
Secure Your Messages with IBM MQ Advanced Message SecuritySecure Your Messages with IBM MQ Advanced Message Security
Secure Your Messages with IBM MQ Advanced Message Security
Morag Hughson
 
JMS Providers Overview
JMS Providers OverviewJMS Providers Overview
JMS Providers OverviewVadym Lotar
 
An Introduction to the Message Queuing Technology & IBM WebSphere MQ
An Introduction to the Message Queuing Technology & IBM WebSphere MQAn Introduction to the Message Queuing Technology & IBM WebSphere MQ
An Introduction to the Message Queuing Technology & IBM WebSphere MQ
Ravi Yogesh
 
IBM MQ Overview (IBM Message Queue)
IBM MQ Overview (IBM Message Queue)IBM MQ Overview (IBM Message Queue)
IBM MQ Overview (IBM Message Queue)
Juarez Junior
 
NServiceBus - introduction to a message based distributed architecture
NServiceBus - introduction to a message based distributed architectureNServiceBus - introduction to a message based distributed architecture
NServiceBus - introduction to a message based distributed architecture
Mauro Servienti
 
WSO2 Product Release webinar - WSO2 Message Broker 2.2.0
WSO2 Product Release webinar - WSO2 Message Broker 2.2.0WSO2 Product Release webinar - WSO2 Message Broker 2.2.0
WSO2 Product Release webinar - WSO2 Message Broker 2.2.0WSO2
 
Reliable System Integration and Scaling with WSO2 Message Broker
Reliable System Integration and Scaling with WSO2 Message BrokerReliable System Integration and Scaling with WSO2 Message Broker
Reliable System Integration and Scaling with WSO2 Message Broker
WSO2
 
Narayana 5: The premier open source transaction manager
Narayana 5: The premier open source transaction manager Narayana 5: The premier open source transaction manager
Narayana 5: The premier open source transaction manager
Virtual JBoss User Group
 
Interconnect 2017: 6893 Keep out the bad guys by securing your MQ messaging e...
Interconnect 2017: 6893 Keep out the bad guys by securing your MQ messaging e...Interconnect 2017: 6893 Keep out the bad guys by securing your MQ messaging e...
Interconnect 2017: 6893 Keep out the bad guys by securing your MQ messaging e...
Robert Parker
 
Implementing CloudStack's VPC feature
Implementing CloudStack's VPC featureImplementing CloudStack's VPC feature
Implementing CloudStack's VPC feature
Marcus L Sorensen
 
Virtacore - vCloud Express
Virtacore - vCloud ExpressVirtacore - vCloud Express
Virtacore - vCloud Express
Virtacore Systems
 
IBM MQ - better application performance
IBM MQ - better application performanceIBM MQ - better application performance
IBM MQ - better application performance
MarkTaylorIBM
 
IBM MQ v8 and JMS 2.0
IBM MQ v8 and JMS 2.0IBM MQ v8 and JMS 2.0
IBM MQ v8 and JMS 2.0
Matthew White
 
Virtualising Your Data Center
Virtualising Your Data CenterVirtualising Your Data Center
Virtualising Your Data CenterLai Yoong Seng
 

What's hot (20)

IBM Websphere MQ Basic
IBM Websphere MQ BasicIBM Websphere MQ Basic
IBM Websphere MQ Basic
 
[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues
 
Introduction to NServiceBus
Introduction to NServiceBusIntroduction to NServiceBus
Introduction to NServiceBus
 
19 08-22 introduction to activeMQ
19 08-22 introduction to activeMQ19 08-22 introduction to activeMQ
19 08-22 introduction to activeMQ
 
Secure Your Messages with IBM MQ Advanced Message Security
Secure Your Messages with IBM MQ Advanced Message SecuritySecure Your Messages with IBM MQ Advanced Message Security
Secure Your Messages with IBM MQ Advanced Message Security
 
JMS Providers Overview
JMS Providers OverviewJMS Providers Overview
JMS Providers Overview
 
An Introduction to the Message Queuing Technology & IBM WebSphere MQ
An Introduction to the Message Queuing Technology & IBM WebSphere MQAn Introduction to the Message Queuing Technology & IBM WebSphere MQ
An Introduction to the Message Queuing Technology & IBM WebSphere MQ
 
WebSphere MQ tutorial
WebSphere MQ tutorialWebSphere MQ tutorial
WebSphere MQ tutorial
 
IBM MQ Overview (IBM Message Queue)
IBM MQ Overview (IBM Message Queue)IBM MQ Overview (IBM Message Queue)
IBM MQ Overview (IBM Message Queue)
 
NServiceBus - introduction to a message based distributed architecture
NServiceBus - introduction to a message based distributed architectureNServiceBus - introduction to a message based distributed architecture
NServiceBus - introduction to a message based distributed architecture
 
WSO2 Product Release webinar - WSO2 Message Broker 2.2.0
WSO2 Product Release webinar - WSO2 Message Broker 2.2.0WSO2 Product Release webinar - WSO2 Message Broker 2.2.0
WSO2 Product Release webinar - WSO2 Message Broker 2.2.0
 
Reliable System Integration and Scaling with WSO2 Message Broker
Reliable System Integration and Scaling with WSO2 Message BrokerReliable System Integration and Scaling with WSO2 Message Broker
Reliable System Integration and Scaling with WSO2 Message Broker
 
Narayana 5: The premier open source transaction manager
Narayana 5: The premier open source transaction manager Narayana 5: The premier open source transaction manager
Narayana 5: The premier open source transaction manager
 
Interconnect 2017: 6893 Keep out the bad guys by securing your MQ messaging e...
Interconnect 2017: 6893 Keep out the bad guys by securing your MQ messaging e...Interconnect 2017: 6893 Keep out the bad guys by securing your MQ messaging e...
Interconnect 2017: 6893 Keep out the bad guys by securing your MQ messaging e...
 
Implementing CloudStack's VPC feature
Implementing CloudStack's VPC featureImplementing CloudStack's VPC feature
Implementing CloudStack's VPC feature
 
Hyper-V in Windows 8
Hyper-V in Windows 8 Hyper-V in Windows 8
Hyper-V in Windows 8
 
Virtacore - vCloud Express
Virtacore - vCloud ExpressVirtacore - vCloud Express
Virtacore - vCloud Express
 
IBM MQ - better application performance
IBM MQ - better application performanceIBM MQ - better application performance
IBM MQ - better application performance
 
IBM MQ v8 and JMS 2.0
IBM MQ v8 and JMS 2.0IBM MQ v8 and JMS 2.0
IBM MQ v8 and JMS 2.0
 
Virtualising Your Data Center
Virtualising Your Data CenterVirtualising Your Data Center
Virtualising Your Data Center
 

Similar to Event-driven architecture with Java technology stack

AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
QCloudMentor
 
Message Oriented Middleware
Message Oriented MiddlewareMessage Oriented Middleware
Message Oriented Middleware
Manuswath K.B
 
Message Queuing (MSMQ)
Message Queuing (MSMQ)Message Queuing (MSMQ)
Message Queuing (MSMQ)
Senior Dev
 
apachekafka-160907180205.pdf
apachekafka-160907180205.pdfapachekafka-160907180205.pdf
apachekafka-160907180205.pdf
TarekHamdi8
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
Srikrishna k
 
Kafka tutorial
Kafka tutorialKafka tutorial
Kafka tutorial
Srikrishna k
 
ServerSentEventsV2.pdf
ServerSentEventsV2.pdfServerSentEventsV2.pdf
ServerSentEventsV2.pdf
Alessandro Minoccheri
 
Exchange 2013 Architecture Poster
Exchange 2013 Architecture PosterExchange 2013 Architecture Poster
Exchange 2013 Architecture Poster
Rian Yulian
 
Microservices deck
Microservices deckMicroservices deck
Microservices deck
Raja Chattopadhyay
 
The Overview of Microservices Architecture
The Overview of Microservices ArchitectureThe Overview of Microservices Architecture
The Overview of Microservices Architecture
Paria Heidari
 
Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQ
Zoran Majstorovic
 
Event driven-arch
Event driven-archEvent driven-arch
Event driven-arch
Mohammed Shoaib
 
Beyond REST and RPC: Asynchronous Eventing and Messaging Patterns
Beyond REST and RPC: Asynchronous Eventing and Messaging PatternsBeyond REST and RPC: Asynchronous Eventing and Messaging Patterns
Beyond REST and RPC: Asynchronous Eventing and Messaging Patterns
Clemens Vasters
 
Enterprise messaging with jms
Enterprise messaging with jmsEnterprise messaging with jms
Enterprise messaging with jms
Sridhar Reddy
 
Introduction to Kafka with Spring Integration
Introduction to Kafka with Spring IntegrationIntroduction to Kafka with Spring Integration
Introduction to Kafka with Spring Integration
Borislav Markov
 
Message queue architecture
Message queue architectureMessage queue architecture
Message queue architecture
Majdee Zoabi
 
ServerSentEvents.pdf
ServerSentEvents.pdfServerSentEvents.pdf
ServerSentEvents.pdf
Alessandro Minoccheri
 
Designing distributed, scalable and reliable systems using NServiceBus
Designing distributed, scalable and reliable systems using NServiceBusDesigning distributed, scalable and reliable systems using NServiceBus
Designing distributed, scalable and reliable systems using NServiceBus
Mauro Servienti
 
IBM IMPACT 2014 - AMC-1882 Building a Scalable & Continuously Available IBM M...
IBM IMPACT 2014 - AMC-1882 Building a Scalable & Continuously Available IBM M...IBM IMPACT 2014 - AMC-1882 Building a Scalable & Continuously Available IBM M...
IBM IMPACT 2014 - AMC-1882 Building a Scalable & Continuously Available IBM M...
Peter Broadhurst
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
Ramakrishna kapa
 

Similar to Event-driven architecture with Java technology stack (20)

AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
 
Message Oriented Middleware
Message Oriented MiddlewareMessage Oriented Middleware
Message Oriented Middleware
 
Message Queuing (MSMQ)
Message Queuing (MSMQ)Message Queuing (MSMQ)
Message Queuing (MSMQ)
 
apachekafka-160907180205.pdf
apachekafka-160907180205.pdfapachekafka-160907180205.pdf
apachekafka-160907180205.pdf
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Kafka tutorial
Kafka tutorialKafka tutorial
Kafka tutorial
 
ServerSentEventsV2.pdf
ServerSentEventsV2.pdfServerSentEventsV2.pdf
ServerSentEventsV2.pdf
 
Exchange 2013 Architecture Poster
Exchange 2013 Architecture PosterExchange 2013 Architecture Poster
Exchange 2013 Architecture Poster
 
Microservices deck
Microservices deckMicroservices deck
Microservices deck
 
The Overview of Microservices Architecture
The Overview of Microservices ArchitectureThe Overview of Microservices Architecture
The Overview of Microservices Architecture
 
Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQ
 
Event driven-arch
Event driven-archEvent driven-arch
Event driven-arch
 
Beyond REST and RPC: Asynchronous Eventing and Messaging Patterns
Beyond REST and RPC: Asynchronous Eventing and Messaging PatternsBeyond REST and RPC: Asynchronous Eventing and Messaging Patterns
Beyond REST and RPC: Asynchronous Eventing and Messaging Patterns
 
Enterprise messaging with jms
Enterprise messaging with jmsEnterprise messaging with jms
Enterprise messaging with jms
 
Introduction to Kafka with Spring Integration
Introduction to Kafka with Spring IntegrationIntroduction to Kafka with Spring Integration
Introduction to Kafka with Spring Integration
 
Message queue architecture
Message queue architectureMessage queue architecture
Message queue architecture
 
ServerSentEvents.pdf
ServerSentEvents.pdfServerSentEvents.pdf
ServerSentEvents.pdf
 
Designing distributed, scalable and reliable systems using NServiceBus
Designing distributed, scalable and reliable systems using NServiceBusDesigning distributed, scalable and reliable systems using NServiceBus
Designing distributed, scalable and reliable systems using NServiceBus
 
IBM IMPACT 2014 - AMC-1882 Building a Scalable & Continuously Available IBM M...
IBM IMPACT 2014 - AMC-1882 Building a Scalable & Continuously Available IBM M...IBM IMPACT 2014 - AMC-1882 Building a Scalable & Continuously Available IBM M...
IBM IMPACT 2014 - AMC-1882 Building a Scalable & Continuously Available IBM M...
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 

More from Anna Shymchenko

Константин Маркович: "Creating modular application using Spring Boot "
Константин Маркович: "Creating modular application using Spring Boot "Константин Маркович: "Creating modular application using Spring Boot "
Константин Маркович: "Creating modular application using Spring Boot "
Anna Shymchenko
 
Евгений Бова: "Modularity in Java: introduction to Jigsaw through the prism o...
Евгений Бова: "Modularity in Java: introduction to Jigsaw through the prism o...Евгений Бова: "Modularity in Java: introduction to Jigsaw through the prism o...
Евгений Бова: "Modularity in Java: introduction to Jigsaw through the prism o...
Anna Shymchenko
 
Евгений Руднев: "Programmers Approach to Error Handling"
Евгений Руднев: "Programmers Approach to Error Handling"Евгений Руднев: "Programmers Approach to Error Handling"
Евгений Руднев: "Programmers Approach to Error Handling"
Anna Shymchenko
 
Александр Куцан: "Static Code Analysis in C++"
Александр Куцан: "Static Code Analysis in C++" Александр Куцан: "Static Code Analysis in C++"
Александр Куцан: "Static Code Analysis in C++"
Anna Shymchenko
 
Алесей Решта: “Robotics Sport & Luxoft Open Robotics Club”
Алесей Решта: “Robotics Sport & Luxoft Open Robotics Club” Алесей Решта: “Robotics Sport & Luxoft Open Robotics Club”
Алесей Решта: “Robotics Sport & Luxoft Open Robotics Club”
Anna Shymchenko
 
Орхан Гасимов: "Reactive Applications in Java with Akka"
Орхан Гасимов: "Reactive Applications in Java with Akka"Орхан Гасимов: "Reactive Applications in Java with Akka"
Орхан Гасимов: "Reactive Applications in Java with Akka"
Anna Shymchenko
 
Евгений Хыст: "Server-Side Geo-Clustering Based on Geohash"
Евгений Хыст: "Server-Side Geo-Clustering Based on Geohash"Евгений Хыст: "Server-Side Geo-Clustering Based on Geohash"
Евгений Хыст: "Server-Side Geo-Clustering Based on Geohash"
Anna Shymchenko
 
Денис Прокопюк: “JMX in Java EE applications”
Денис Прокопюк: “JMX in Java EE applications”Денис Прокопюк: “JMX in Java EE applications”
Денис Прокопюк: “JMX in Java EE applications”
Anna Shymchenko
 
Роман Яворский "Introduction to DevOps"
Роман Яворский "Introduction to DevOps"Роман Яворский "Introduction to DevOps"
Роман Яворский "Introduction to DevOps"
Anna Shymchenko
 
Максим Сабарня “NoSQL: Not only SQL in developer’s life”
Максим Сабарня “NoSQL: Not only SQL in developer’s life” Максим Сабарня “NoSQL: Not only SQL in developer’s life”
Максим Сабарня “NoSQL: Not only SQL in developer’s life”
Anna Shymchenko
 
Андрей Лисниченко "SQL Injection"
Андрей Лисниченко "SQL Injection"Андрей Лисниченко "SQL Injection"
Андрей Лисниченко "SQL Injection"
Anna Shymchenko
 
Светлана Мухина "Metrics on agile projects"
Светлана Мухина "Metrics on agile projects"Светлана Мухина "Metrics on agile projects"
Светлана Мухина "Metrics on agile projects"
Anna Shymchenko
 
Андрей Слободяник "Test driven development using mockito"
Андрей Слободяник "Test driven development using mockito"Андрей Слободяник "Test driven development using mockito"
Андрей Слободяник "Test driven development using mockito"
Anna Shymchenko
 
Евгений Хыст "Application performance database related problems"
Евгений Хыст "Application performance database related problems"Евгений Хыст "Application performance database related problems"
Евгений Хыст "Application performance database related problems"
Anna Shymchenko
 
Даурен Муса “IBM WebSphere - expensive but effective”
Даурен Муса “IBM WebSphere - expensive but effective” Даурен Муса “IBM WebSphere - expensive but effective”
Даурен Муса “IBM WebSphere - expensive but effective”
Anna Shymchenko
 
Александр Пашинский "Reinventing Design Patterns with Java 8"
Александр Пашинский "Reinventing Design Patterns with Java 8"Александр Пашинский "Reinventing Design Patterns with Java 8"
Александр Пашинский "Reinventing Design Patterns with Java 8"
Anna Shymchenko
 
Евгений Капинос "Advanced JPA (Java Persistent API)"
Евгений Капинос "Advanced JPA (Java Persistent API)"Евгений Капинос "Advanced JPA (Java Persistent API)"
Евгений Капинос "Advanced JPA (Java Persistent API)"
Anna Shymchenko
 
Do we need SOLID principles during software development?
Do we need SOLID principles during software development?Do we need SOLID principles during software development?
Do we need SOLID principles during software development?
Anna Shymchenko
 
Guava - Elements of Functional Programming
Guava - Elements of Functional Programming Guava - Elements of Functional Programming
Guava - Elements of Functional Programming
Anna Shymchenko
 
Максим Сабарня и Иван Дрижирук “Vert.x – tool-kit for building reactive app...
 	Максим Сабарня и Иван Дрижирук “Vert.x – tool-kit for building reactive app... 	Максим Сабарня и Иван Дрижирук “Vert.x – tool-kit for building reactive app...
Максим Сабарня и Иван Дрижирук “Vert.x – tool-kit for building reactive app...
Anna Shymchenko
 

More from Anna Shymchenko (20)

Константин Маркович: "Creating modular application using Spring Boot "
Константин Маркович: "Creating modular application using Spring Boot "Константин Маркович: "Creating modular application using Spring Boot "
Константин Маркович: "Creating modular application using Spring Boot "
 
Евгений Бова: "Modularity in Java: introduction to Jigsaw through the prism o...
Евгений Бова: "Modularity in Java: introduction to Jigsaw through the prism o...Евгений Бова: "Modularity in Java: introduction to Jigsaw through the prism o...
Евгений Бова: "Modularity in Java: introduction to Jigsaw through the prism o...
 
Евгений Руднев: "Programmers Approach to Error Handling"
Евгений Руднев: "Programmers Approach to Error Handling"Евгений Руднев: "Programmers Approach to Error Handling"
Евгений Руднев: "Programmers Approach to Error Handling"
 
Александр Куцан: "Static Code Analysis in C++"
Александр Куцан: "Static Code Analysis in C++" Александр Куцан: "Static Code Analysis in C++"
Александр Куцан: "Static Code Analysis in C++"
 
Алесей Решта: “Robotics Sport & Luxoft Open Robotics Club”
Алесей Решта: “Robotics Sport & Luxoft Open Robotics Club” Алесей Решта: “Robotics Sport & Luxoft Open Robotics Club”
Алесей Решта: “Robotics Sport & Luxoft Open Robotics Club”
 
Орхан Гасимов: "Reactive Applications in Java with Akka"
Орхан Гасимов: "Reactive Applications in Java with Akka"Орхан Гасимов: "Reactive Applications in Java with Akka"
Орхан Гасимов: "Reactive Applications in Java with Akka"
 
Евгений Хыст: "Server-Side Geo-Clustering Based on Geohash"
Евгений Хыст: "Server-Side Geo-Clustering Based on Geohash"Евгений Хыст: "Server-Side Geo-Clustering Based on Geohash"
Евгений Хыст: "Server-Side Geo-Clustering Based on Geohash"
 
Денис Прокопюк: “JMX in Java EE applications”
Денис Прокопюк: “JMX in Java EE applications”Денис Прокопюк: “JMX in Java EE applications”
Денис Прокопюк: “JMX in Java EE applications”
 
Роман Яворский "Introduction to DevOps"
Роман Яворский "Introduction to DevOps"Роман Яворский "Introduction to DevOps"
Роман Яворский "Introduction to DevOps"
 
Максим Сабарня “NoSQL: Not only SQL in developer’s life”
Максим Сабарня “NoSQL: Not only SQL in developer’s life” Максим Сабарня “NoSQL: Not only SQL in developer’s life”
Максим Сабарня “NoSQL: Not only SQL in developer’s life”
 
Андрей Лисниченко "SQL Injection"
Андрей Лисниченко "SQL Injection"Андрей Лисниченко "SQL Injection"
Андрей Лисниченко "SQL Injection"
 
Светлана Мухина "Metrics on agile projects"
Светлана Мухина "Metrics on agile projects"Светлана Мухина "Metrics on agile projects"
Светлана Мухина "Metrics on agile projects"
 
Андрей Слободяник "Test driven development using mockito"
Андрей Слободяник "Test driven development using mockito"Андрей Слободяник "Test driven development using mockito"
Андрей Слободяник "Test driven development using mockito"
 
Евгений Хыст "Application performance database related problems"
Евгений Хыст "Application performance database related problems"Евгений Хыст "Application performance database related problems"
Евгений Хыст "Application performance database related problems"
 
Даурен Муса “IBM WebSphere - expensive but effective”
Даурен Муса “IBM WebSphere - expensive but effective” Даурен Муса “IBM WebSphere - expensive but effective”
Даурен Муса “IBM WebSphere - expensive but effective”
 
Александр Пашинский "Reinventing Design Patterns with Java 8"
Александр Пашинский "Reinventing Design Patterns with Java 8"Александр Пашинский "Reinventing Design Patterns with Java 8"
Александр Пашинский "Reinventing Design Patterns with Java 8"
 
Евгений Капинос "Advanced JPA (Java Persistent API)"
Евгений Капинос "Advanced JPA (Java Persistent API)"Евгений Капинос "Advanced JPA (Java Persistent API)"
Евгений Капинос "Advanced JPA (Java Persistent API)"
 
Do we need SOLID principles during software development?
Do we need SOLID principles during software development?Do we need SOLID principles during software development?
Do we need SOLID principles during software development?
 
Guava - Elements of Functional Programming
Guava - Elements of Functional Programming Guava - Elements of Functional Programming
Guava - Elements of Functional Programming
 
Максим Сабарня и Иван Дрижирук “Vert.x – tool-kit for building reactive app...
 	Максим Сабарня и Иван Дрижирук “Vert.x – tool-kit for building reactive app... 	Максим Сабарня и Иван Дрижирук “Vert.x – tool-kit for building reactive app...
Максим Сабарня и Иван Дрижирук “Vert.x – tool-kit for building reactive app...
 

Recently uploaded

Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 

Recently uploaded (20)

Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 

Event-driven architecture with Java technology stack

  • 1. www.luxoft.com EVENT-DRIVEN ARCHITECTURE WITH JAVA TECHNOLOGY STACK Evgeniy Khyst 29.10.2015
  • 2. www.luxoft.com Event-Driven Architecture with Java Technology Stack 1. Event-Driven Architecture 2. Using Events in Java EE CDI Applications 3. Message-Oriented Middleware 4. Java Message Service 5. Message Queue and Publish-Subscribe Patterns 6. Reliable Message Delivery 7. Message Priority and Scheduled Delivery 8. Distributed Transactions
  • 3. www.luxoft.com Why Do We Need Event-Driven Architecture? Let’s consider checkout shopping cart functionality for e-commerce framework. public void checkoutShoppingCart(ShoppingOrder order) { persistInDatabase(order); sendEmailNotification(order); shipToTheNearestWarehouse(order); scheduleShippingToCustomer(order); exportToERP(order); } Method checkoutShoppingCart becomes unmaintainable mess.
  • 4. www.luxoft.com Why Do We Need Event-Driven Architecture? • The growing complexity of enterprise applications often result in bad architecture, and organization is spending more and more money building IT systems; • Event-driven architecture is designed to solve these problems by decoupling software components and services.
  • 5. www.luxoft.com Why Do We Need Event-Driven Architecture? The goal of event-driven architecture is to allow to loosely couple system components together.
  • 6. www.luxoft.com What Is Event? • Event is a significant change in state; • Events are transmitted among loosely coupled services; • Events represent milestones in business process; • Services observe events and react on them.
  • 7. www.luxoft.com Observer Pattern • Observer pattern helps to understand event-driven architecture concepts; • In observer pattern an object, called the subject, maintains a list of its dependents, called observers, and notifies them of any state changes; • Making use of events and observers makes services even more loosely coupled.
  • 8. www.luxoft.com Loose Coupling • Components are loosely coupled if they have little or no direct knowledge of each other; • Coupling refers to classes, interfaces, services, software components; • When a dependent class contains a pointer directly to a concrete class which provides the required behavior, they are tightly coupled; • When events and observers are used, class firing the event has no knowledge of class observing and reacting on this event.
  • 9. www.luxoft.com Performance • Designing systems to be asynchronous from end-to-end allows to minimize the amount of threads blocking on IO operations, and to use network bandwidth to its full capacity; • All observers will react in parallel on notification about event, making multi-core CPUs and clusters work on its highest capacity; • When distributed system runs in cluster, events can be delivered to any host of the cluster providing transparent load-balancing and failover.
  • 10. www.luxoft.com Performance Event-driven architecture allows to create much higher performance applications.
  • 11. www.luxoft.com Using Events in Java EE CDI Applications ShoppingOrderEvent bean defines an event using properties, which has setter and getter methods. private ShoppingOrder order; ... public ShoppingOrderEvent() { }
  • 12. www.luxoft.com Using Events in Java EE CDI Applications Events are handled using an observer method. public void persistInDatabase(@Observes ShoppingOrderEvent event) { ... } public void sendEmailNotification(@Observes ShoppingOrderEvent event) { ... } public void shipToTheNearestWarehouse(@Observes ShoppingOrderEvent event) { ... } public void scheduleShippingToCustomer(@Observes ShoppingOrderEvent event) { ... } public void exportToERP(@Observes ShoppingOrderEvent event) { ... }
  • 13. www.luxoft.com Using Events in Java EE CDI Applications To fire an event and notify any observer method, call the javax.enterprise.event.Event.fire method. @Inject private Event<ShoppingOrderEvent> orderEvent; public void checkoutShoppingCart(ShoppingOrder order) { ShoppingOrderEvent orderEventPayload = new ShoppingOrderEvent(); ... orderEvent.fire(orderEventPayload); }
  • 14. www.luxoft.com Using Events in Java EE CDI Applications • Each observer method as well as method firing event can be located in different classes and packages; • The senders and consumers of messages are completely independent and know nothing of each other; • Maximum loose coupling is achieved.
  • 15. www.luxoft.com Message-Oriented Middleware • Events can be presented as messages; • Message-oriented middleware (MOM) is software supporting sending and receiving messages between distributed systems; • MOM is sometimes called messaging system or message broker and is an extra component in the architecture.
  • 16. www.luxoft.com Message-Oriented Middleware Messaging systems usually provide protocol or API for sending and receiving messages: • JMS - Java Message Service • AMQP - Advanced Message Queuing Protocol • STOMP - Simple Text Oriented Messaging Protocol • RESTful API • System specific APIs
  • 17. www.luxoft.com Message-Oriented Middleware Messaging systems usually support two styles of asynchronous messaging: • Point-to-Point • Publish-Subscribe
  • 18. www.luxoft.com Java Message Service • Java Message Service (JMS) is a standard of middleware for sending messages, that allows applications, running on Java EE platform, to create, send, receive and read messages; • JMS is a Java API, part of Java EE specification.
  • 19. www.luxoft.com JMS 2.0 Example Sending messages using JMS. @Resource(mappedName = "java:jboss/jms/queue/exampleQueue") private Queue exampleQueue; @Inject private JMSContext context; ... public void sendMessage(String text) { context.createProducer().send(exampleQueue, text); }
  • 20. www.luxoft.com JMS 2.0 Example Synchronous receiving messages using JMS. @Resource(mappedName = "java:jboss/jms/queue/exampleQueue") private Queue exampleQueue; @Inject private JMSContext context; ... public String receiveMessage() { return context.createConsumer(exampleQueue) .receiveBody(String.class); }
  • 21. www.luxoft.com Message-Driven Bean Example Receiving messages with message-driven bean (MDB) an EJB that allows Java EE applications to process messages asynchronously. @MessageDriven(name = "ExampleMDB", activationConfig = { @ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "java:jboss/jms/queue/exampleQueue"), @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")}) public class ExampleMDB implements MessageListener { public void onMessage(Message message) { try { if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; ... } } catch (JMSException e) { throw new RuntimeException(e); } } }
  • 22. www.luxoft.com Message Queue Pattern 1. Message is sent to queue; 2. Message is persisted to provide a guarantee of delivery; 3. Messaging system delivers the message to a consumer; 4. Consumer processes and acknowledges the message; 5. Message is removed from the queue and is not available to be delivered again; 6. If the system crashes before the messaging server receives an acknowledgement from the consumer, then on recovery, the message will be delivered to a consumer again.
  • 23. www.luxoft.com Publish-Subscribe Pattern • Message is sent to topic; • Each subscription receives a copy of each message sent to the topic; • Durable subscriptions receives all messages sent to the topic even if consumer was not available for some time; • Non durable subscriptions receives only those messages, that were sent while consumer was available.
  • 24. www.luxoft.com Reliable Message Delivery Message delivery occurs in two hops: • the first hop takes the message from the producer to a physical destination on the broker • the second hop takes the message from that destination to the consumer
  • 25. www.luxoft.com Reliable Message Delivery A message can be lost in one of three ways: • on its hop from the producer to the broker • on its hop from the broker to the consumer • while it’s in broker memory (if the broker fails) Reliable delivery guarantees that delivery will not fail in any of these ways.
  • 26. www.luxoft.com Reliable Message Delivery Two mechanisms are used to ensure reliable delivery: • acknowledgments or transactions are used to make sure message was successfully consumed • messaging system stores messages in a persistent store called journal so that if the broker fails before the message is consumed, the stored copy of the message can be redelivered on recovery
  • 27. www.luxoft.com Reliable Message Delivery Messages are either durable or non-durable. • Durable messages will be persisted in permanent storage and will survive server failure or restart; • Non durable messages will not survive server failure or restart.
  • 28. www.luxoft.com Message Redelivery • Messages can be delivered unsuccessfully (if the broker fails); • Such a message goes back to the JMS destination ready to be redelivered.
  • 29. www.luxoft.com Message Redelivery • To prevent clogging the system with messages that are delivered again and again without success, messaging systems define dead letter concept; • After a specified unsuccessful delivery attempts, the message is removed from the destination and put instead in a dead letter queue.
  • 30. www.luxoft.com Message Redelivery • Messaging systems also defines delayed redelivery concept; • Redelivery will be scheduled with a delay; • Delay between delivery attempts can increase exponentially.
  • 31. www.luxoft.com Message Expiration • The time messages are retained in messaging system before it will be removed can be limited; • JMS providers set JMSExpiration field when a message is sent; • When messages are expired, they are removed from the queue and sent to the expiry queue.
  • 32. www.luxoft.com Message Priority • By default messaging system queues operates as FIFO queues; • Explicitly specifying message priority will make messaging queue operate as priority queue; • Message priority can be used to influence the delivery order for messages; • The message priority value is of type integer, ranging from 0 (the lowest) to 9 (the highest); • Messages of higher priorities will likely be delivered before those of lower priorities.
  • 33. www.luxoft.com Message Priority • If business process can be decomposed into set of tasks or activities, message priority can be used to interrupt low priority business processes if higher priority business process was started; • High priority requests will be processed as fast as possible and low priority requests will be processed when there will be free computing resources.
  • 34. www.luxoft.com Message Priority 1. Send message with appropriate priority to the queue to start business process; 2. Service consuming the message should perform corresponding activity and at the end send another message into the queue propagating initial priority to proceed business process; 3. If there are messages with higher priorities in the queue and there are not enough computing resources, messages with higher priorities will be processed first and after that messages with lower priority; 4. Business process with lower priority will be “interrupted” to let higher priority business process complete.
  • 35. www.luxoft.com Scheduled Delivery Most messaging systems provide a way to schedule message delivery. This feature will be useful when: • Business process should not be started immediately after message was sent; • Business process should be cancelled after some timeout.
  • 36. www.luxoft.com Scheduled Delivery HornetQ example of scheduled delivery. ... TextMessage message = session.createTextMessage( "This is a scheduled message message which will be delivered in 5 sec."); message.setLongProperty("_HQ_SCHED_DELIVERY", System.currentTimeMillis() + 5000); producer.send(message); ... // message will not be received immediately but 5 seconds later TextMessage messageReceived = (TextMessage) consumer.receive(); ...
  • 37. www.luxoft.com Distributed Transactions • The JMS specification supports distributed transactions; • The production and consumption of messages can be part of a larger, distributed transaction that includes operations involving other resource managers, such as database systems; • A distributed transaction manager, like the one supplied by the application server, must be available to support distributed transactions.
  • 38. www.luxoft.com Two-Phase Commit • Distributed transactions with two-phase commit (2PC) are also called XA transactions; • Support for distributed transactions means that messaging clients can participate in distributed transactions through the XAResource interface defined by JTA; • This interface defines a number of methods used in implementing two-phase commit.
  • 39. www.luxoft.com Two-Phase Commit • Phase 1 - Prepare. Transaction coordinator, asks participating resources to promise to commit or rollback the transaction. If any resource cannot prepare, the transaction is rolled back; • Phase 2 - Commit or Rollback. If all participants respond to the coordinator that they are prepared, then the coordinator asks all resources to commit the transaction. 2PC is done automatically by transaction manager (typically a part of Java EE application server) and requires no actions from developer.
  • 40. www.luxoft.com Best Effort One-Phase Commit The best efforts 1PC pattern is synchronized single-phase commit of a number of resources. The message transaction is started before the database one, and they end (either commit or rollback) in reverse order. 1. Start messaging transaction 2. Receive message 3. Start database transaction 4. Update database 5. Commit database transaction 6. Commit messaging transaction
  • 41. www.luxoft.com Best Effort One-Phase Commit • If the commit of the database resource fails, messaging transaction will be rolled back; • If the commit of the database resource success but the commit of the messaging transaction fails, it will result in duplicate message (message will be redelivered); • Best effort 1PC commit can be used if system is able to appropriately handle duplicate messages.
  • 42. www.luxoft.com Best Effort One-Phase Commit Best effort 1PC example in Spring. <bean id="nonTransactionalConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter"> <property name="targetConnectionFactory" ref="hornetQConnectionFactory"/> <property name="username" value="guest"/> <property name="password" value="guest"/> </bean> <bean id="connectionFactory" class="org.springframework.jms.connection.TransactionAwareConnectionFactoryProxy"> <property name="targetConnectionFactory" ref="nonTransactionalConnectionFactory"/> <property name="synchedLocalTransactionAllowed" value="true"/> </bean> ...
  • 43. www.luxoft.com Best Effort One-Phase Commit ... <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <constructor-arg ref="dataSource"/> </bean> <tx:annotation-driven transaction-manager="transactionManager"/> ...
  • 44. www.luxoft.com Best Effort One-Phase Commit ... <jms:listener-container connection-factory="connectionFactory" transaction-manager="transactionManager" concurrency="10"> <jms:listener destination="exampleQueue" ref="myListener"/> </jms:listener-container> ... <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="connectionFactory"/> <property name="sessionTransacted" ref="true"/> </bean> ...
  • 45. www.luxoft.com Transactions and Redelivery • It is a common practice to rely on message redelivery in case of distributed transaction failure; • If it is acceptable for business process to be repeated, exception handling in code can be skipped; • Whole distributed transaction can be rolled back, message will be returned to queue and delivered to available consumer to be processed again.