4th seminar message

Preview:

Citation preview

Event & Message

4th seminar (2016)

Overview - Enhancement

Git

SpringBoot

TDD

TestNG

Mockito

Code Coverage

JPA

Vaadin

Nexus

Guava

Aligner

NLP

V8

Parser

Junit

RabbitMQ

Solr&Elastic search

Corpus

NoSQL

TermsEvent

In computing, an event is an action or occurrence recognised by software that may be handled by the software.

Message

In computing, messages passed between programs or between components of a single program.

Traditional java event handling 1

Object A

Application 1

ButtonListener

Object B

message

message

User event

implement an interface defined with the event

Traditional java event handling 2

Object

Application 1

message

Object

Application 2

message

DBMS

soc soc

Google global bus publish-subscribe-style communication between components.Add an annotation(@Subscribe) to ObjectAEventBus.register(ObjectA)EventBus.post(ObjectA)

Google global bus

Object A

Application 1

Register

Event busObject B Post with ObjectA’s event

Google global bus Example

// Class is typically registered by the container.class EventBusChangeRecorder { @Subscribe public void recordCustomerChange(ChangeEvent e) { recordChange(e.getChange()); }}// somewhere during initializationeventBus.register(new EventBusChangeRecorder());// much laterpublic void changeCustomer() { ChangeEvent event = getChangeEvent(); eventBus.post(event);}

Message Broker?

Message brokers are elements in telecommunication networks where software applications communicate by exchanging formally-defined messages.List of message broker software

AMQP : RabbitMQ, Apache QpidMQ : IBM WebSphere, Apache ActiveMQ(JMS)AQ : Oracle Advanced Queuing

Message Queue and broker

Object

Application 1

Send/Recv

Object

Application 2

Send/Recv

Message broker

producer consumer

RabbitMQReliability

Flexible Routing

Clustering

Runs on all major operating systems

Open source

Multi-protocolSTOMP : text-based messaging protocol, MQTT : binary protocolAMQP 1.0 : wire protocol, HTTP : JSON-RPC

Many Clients : java, ruby, python, .net, C, C++ and so on.

Management UI

RabbitMQ – queuingSimple queue

RabbitMQ – queuingWork queue : consuming by multiple worker

RabbitMQ – queuingPublish / subscribe : broadcast log messages to many receivers. (X : Exchange)

RabbitMQ – queuingRouting

RabbitMQ – queuingTopic

RabbitMQ – queuingRPC : relaying remote procedure call

Demo

Recommended