ICTA Technology Meetup 12ICTA Technology Meetup 12
By Crishantha Nanayakkara
Message Brokers
Service Invocation
●
Synchronous
– The consumer uses a single thread to invoke 
the service. The thread sends the request, 
blocks it until it gets the response from the 
service
●
Asynchronous
– The consumer uses a pair of threads to invoke 
the service. The first thread sends the request 
and releases itself. The second thread gets the 
response from the service once it completes 
its task.
Synchronous – RPC Style
●
The predominant approach
– RMI, SOAP / REST Web Services, CORBA
●
Request/Response pattern
– Calls remote methods and waits for the 
response
●
Problems
– Tight coupling
– What about network failures or long latencies?
Asynchronous – Messaging Style
●
Decoupled
●
Reliable
– Message can be stored and forwarded
– Redelivery until the message processed
●
Solves typical problems of distributed systems
– Network Failures 
– Network Latency issues
Asynchronous – Messaging Style
Asynchronous – Messaging Style
●
Broadcast Oriented – All messages goes to all 
applications
●
Point­point – All messages goes to one 
application
●
Subscription based – All messages goes only to 
subscribers 
Messaging is used in distributed 
computing to achieve asynchronous 
communication
Notification and Eventing
Source: Service Oriented Architecture, Concepts, Technology and Design, Thomas Erl
Publisher Subscriber Pattern
Publisher Subscriber Pattern
●
This involves a publisher service that makes 
information categorized by different topics for 
registered subscribers. 
●
Subscribers can select which that they are willing to 
subscribe by interacting directly with a publisher. 
●
Here, When a new piece of information on a given 
topic is available, the publisher broadcasts this 
information to all those subscribers/ services that 
have subscribed to that topic.
Why Message Brokers?
Using a Message Broker
Using a Message Broker
●
A message broker can be used to perform the 
broadcast on the publishers’ behalf. 
●
Reduce the dependency between the publisher and 
the subscriber allowing it for a complete decoupled 
architecture. 
●
Provides the much required flexibility and the 
scalability.
14
Message Broker Standards and 
Implementations
●
The Message Broker protocols / standards:
– JMS (A Java standard)
– MSMQ (.NET implementation)
– AMQP (An open standard)
●
Implementations:
– Apache ActiveMQ (JMS)
– .NET WCF (MSMQ)
– RabbitMQ (AMQP)
– Apache Qpid (AMQP)
– ZeroMQ (AMQP)
15
JMS
●
JMS  is  a  Java  API  that  allows  applications  to 
create, send, receive and read messages.
●
JMS  API  defines  a  common  set  of  interfaces 
and associated semantics that allow programs 
written  in  Java  to  communicate  with  other 
messaging implementations.
16
Advanced Message Queuing Protocol 
(AMQP)
17
AMQP
●
AMQP (Advanced Message Queuing Protocol) 
is an open standard and a wire­level protocol, 
which is designed to support messaging on 
the Internet.
●
AMQP is the only open standard available so 
far for the cross platform interoperability 
between heterogeneous messaging systems 
and message brokers. 
18
AMQP
●
For example, Java Message Producer (JMS 
Client) can send message to a .NET/C# 
consumer with the help of a AMQP Message 
Broker
●
it is inter­operable, reliable, open, 
standardized, complete and safe 
19
JMS vs AMQP
●
JMS has the ability to communicate with non­Java platforms 
like Ruby by using Message Bridges. But this is a bit of a 
complex situation in the Enterprise level Integration.
●
The industry is using AMQP to get rid of this complexity
Message Brokering in SOA
WS­Eventing vs WS­Notification
●
There are two WS specifications  to implement 
the publisher subscriber pattern
– WS­Eventing (A W3C Specification) 
– WS­Notification (An OASIS Specification)
●
Each one uses a different approach and a 
terminology to fulfill the “same task”
●
WS­Eventing is more simpler and WS­
Notification is more detailed
WS­Notification
(with a broker)
WS­Notification
(with a broker)
●
The Notification Broker (Web Service) – Acts on 
behalf of the publisher to perform the role of the 
Notification Producer.
●
The Publisher Registration Manager (Web Service) 
– This provides an interface for subscribers to search 
through and locate items available for registration
●
The Subscription Manager (Web Service) – This 
allows notification producers to access and retrieve 
required subscriber information for a given 
notification message broadcast.
WS­Notification compliant Message 
Brokers
At Alpha Stage – Developed by ICTA TT
WS­Eventing
WS­Eventing compliant Message 
Brokers
The Sample Code
●
https://docs.wso2.org/display/MB210/Web+S
ervice+Client+Sample
ESB Vs Message Broker
Any difference?
Questions ?

ICTA Meetup 12 - Message Brokers