<s>
In	O
software	B-Architecture
architecture	I-Architecture
,	O
publish	B-Operating_System
–	I-Operating_System
subscribe	I-Operating_System
is	O
a	O
messaging	B-Operating_System
pattern	I-Operating_System
where	O
senders	O
of	O
messages	B-Architecture
,	O
called	O
publishers	O
,	O
do	O
not	O
program	O
the	O
messages	B-Architecture
to	O
be	O
sent	O
directly	O
to	O
specific	O
receivers	O
,	O
called	O
subscribers	O
,	O
but	O
instead	O
categorize	O
published	O
messages	B-Architecture
into	O
classes	O
without	O
knowledge	O
of	O
which	O
subscribers	O
,	O
if	O
any	O
,	O
there	O
may	O
be	O
.	O
</s>
<s>
Similarly	O
,	O
subscribers	O
express	O
interest	O
in	O
one	O
or	O
more	O
classes	O
and	O
only	O
receive	O
messages	B-Architecture
that	O
are	O
of	O
interest	O
,	O
without	O
knowledge	O
of	O
which	O
publishers	O
,	O
if	O
any	O
,	O
there	O
are	O
.	O
</s>
<s>
Publish	B-Operating_System
–	I-Operating_System
subscribe	I-Operating_System
is	O
a	O
sibling	O
of	O
the	O
message	B-Operating_System
queue	I-Operating_System
paradigm	O
,	O
and	O
is	O
typically	O
one	O
part	O
of	O
a	O
larger	O
message-oriented	B-Application
middleware	I-Application
system	O
.	O
</s>
<s>
Most	O
messaging	O
systems	O
support	O
both	O
the	O
pub/sub	B-Operating_System
and	O
message	B-Operating_System
queue	I-Operating_System
models	O
in	O
their	O
API	B-Application
;	O
e.g.	O
,	O
Java	B-Language
Message	I-Language
Service	I-Language
(	O
JMS	O
)	O
.	O
</s>
<s>
This	O
pattern	O
provides	O
greater	O
network	O
scalability	B-Architecture
and	O
a	O
more	O
dynamic	O
network	B-Architecture
topology	I-Architecture
,	O
with	O
a	O
resulting	O
decreased	O
flexibility	O
to	O
modify	O
the	O
publisher	O
and	O
the	O
structure	O
of	O
the	O
published	O
data	O
.	O
</s>
<s>
In	O
the	O
publish-subscribe	B-Operating_System
model	O
,	O
subscribers	O
typically	O
receive	O
only	O
a	O
subset	O
of	O
the	O
total	O
messages	B-Architecture
published	O
.	O
</s>
<s>
The	O
process	O
of	O
selecting	O
messages	B-Architecture
for	O
reception	O
and	O
processing	O
is	O
called	O
filtering	O
.	O
</s>
<s>
In	O
a	O
topic-based	O
system	O
,	O
messages	B-Architecture
are	O
published	O
to	O
"	O
topics	O
"	O
or	O
named	O
logical	O
channels	O
.	O
</s>
<s>
Subscribers	O
in	O
a	O
topic-based	O
system	O
will	O
receive	O
all	O
messages	B-Architecture
published	O
to	O
the	O
topics	O
to	O
which	O
they	O
subscribe	O
.	O
</s>
<s>
In	O
a	O
content-based	O
system	O
,	O
messages	B-Architecture
are	O
only	O
delivered	O
to	O
a	O
subscriber	O
if	O
the	O
attributes	O
or	O
content	O
of	O
those	O
messages	B-Architecture
matches	O
constraints	O
defined	O
by	O
the	O
subscriber	O
.	O
</s>
<s>
The	O
subscriber	O
is	O
responsible	O
for	O
classifying	O
the	O
messages	B-Architecture
.	O
</s>
<s>
Some	O
systems	O
support	O
a	O
hybrid	O
of	O
the	O
two	O
;	O
publishers	O
post	O
messages	B-Architecture
to	O
a	O
topic	O
while	O
subscribers	O
register	O
content-based	O
subscriptions	O
to	O
one	O
or	O
more	O
topics	O
.	O
</s>
<s>
In	O
many	O
publish-subscribe	B-Operating_System
systems	O
,	O
publishers	O
post	O
messages	B-Architecture
to	O
an	O
intermediary	O
message	B-General_Concept
broker	I-General_Concept
or	O
event	O
bus	O
,	O
and	O
subscribers	O
register	O
subscriptions	O
with	O
that	O
broker	O
,	O
letting	O
the	O
broker	O
perform	O
the	O
filtering	O
.	O
</s>
<s>
The	O
broker	O
normally	O
performs	O
a	O
store	B-Protocol
and	I-Protocol
forward	I-Protocol
function	O
to	O
route	O
messages	B-Architecture
from	O
publishers	O
to	O
subscribers	O
.	O
</s>
<s>
In	O
addition	O
,	O
the	O
broker	O
may	O
prioritize	O
messages	B-Architecture
in	O
a	O
queue	B-Application
before	O
routing	O
.	O
</s>
<s>
Subscribers	O
may	O
register	O
for	O
specific	O
messages	B-Architecture
at	O
build	O
time	O
,	O
initialization	O
time	O
or	O
runtime	O
.	O
</s>
<s>
Some	O
frameworks	O
and	O
software	O
products	O
use	O
XML	B-Protocol
configuration	O
files	O
to	O
register	O
subscribers	O
.	O
</s>
<s>
This	O
latter	O
approach	O
is	O
used	O
,	O
for	O
example	O
,	O
in	O
database	B-Language
triggers	I-Language
,	O
mailing	O
lists	O
,	O
and	O
RSS	O
.	O
</s>
<s>
The	O
Data	B-Application
Distribution	I-Application
Service	I-Application
(	O
DDS	O
)	O
middleware	O
does	O
not	O
use	O
a	O
broker	O
in	O
the	O
middle	O
.	O
</s>
<s>
Instead	O
,	O
each	O
publisher	O
and	O
subscriber	O
in	O
the	O
pub/sub	B-Operating_System
system	O
shares	O
meta-data	O
about	O
each	O
other	O
via	O
IP	B-Protocol
multicast	I-Protocol
.	O
</s>
<s>
The	O
publisher	O
and	O
the	O
subscribers	O
cache	O
this	O
information	O
locally	O
and	O
route	O
messages	B-Architecture
based	O
on	O
the	O
discovery	O
of	O
each	O
other	O
in	O
the	O
shared	O
cognizance	O
.	O
</s>
<s>
In	O
effect	O
,	O
brokerless	O
architectures	O
require	O
publish/subscribe	B-Operating_System
system	O
to	O
construct	O
an	O
overlay	O
network	O
which	O
allows	O
efficient	O
decentralized	O
routing	O
from	O
publishers	O
to	O
subscribers	O
.	O
</s>
<s>
It	O
was	O
shown	O
by	O
Jon	O
Kleinberg	O
that	O
efficient	O
decentralised	O
routing	O
requires	O
Navigable	O
Small-World	O
topologies	B-Architecture
.	O
</s>
<s>
Such	O
Small-World	O
topologies	B-Architecture
are	O
usually	O
implemented	O
by	O
decentralized	O
or	O
federated	O
publish/subscribe	B-Operating_System
systems	O
.	O
</s>
<s>
Locality-aware	O
publish/subscribe	B-Operating_System
systems	O
construct	O
Small-World	O
topologies	B-Architecture
that	O
route	O
subscriptions	O
through	O
short-distance	O
and	O
low-cost	O
links	O
thereby	O
reducing	O
subscription	O
delivery	O
times	O
.	O
</s>
<s>
One	O
of	O
the	O
earliest	O
publicly	O
described	O
pub/sub	B-Operating_System
systems	O
was	O
the	O
"	O
news	O
"	O
subsystem	O
of	O
the	O
Isis	O
Toolkit	O
,	O
described	O
at	O
the	O
1987	O
Association	O
for	O
Computing	O
Machinery	O
(	O
ACM	O
)	O
Symposium	O
on	O
Operating	O
Systems	O
Principles	O
conference	O
(	O
SOSP	O
'	O
87	O
)	O
,	O
in	O
a	O
paper	O
"	O
Exploiting	O
Virtual	O
Synchrony	O
in	O
Distributed	B-Architecture
Systems	I-Architecture
.	O
</s>
<s>
Publishers	O
are	O
loosely	B-Application
coupled	I-Application
to	O
subscribers	O
,	O
and	O
need	O
not	O
even	O
know	O
of	O
their	O
existence	O
.	O
</s>
<s>
With	O
the	O
topic	O
being	O
the	O
focus	O
,	O
publishers	O
and	O
subscribers	O
are	O
allowed	O
to	O
remain	O
ignorant	O
of	O
system	O
topology	B-Architecture
.	O
</s>
<s>
In	O
the	O
traditional	O
tightly	O
coupled	O
client	B-Operating_System
–	I-Operating_System
server	I-Operating_System
paradigm	I-Operating_System
,	O
the	O
client	O
cannot	O
post	O
messages	B-Architecture
to	O
the	O
server	O
while	O
the	O
server	O
process	O
is	O
not	O
running	O
,	O
nor	O
can	O
the	O
server	O
receive	O
messages	B-Architecture
unless	O
the	O
client	O
is	O
running	O
.	O
</s>
<s>
Many	O
pub/sub	B-Operating_System
systems	O
decouple	O
not	O
only	O
the	O
locations	O
of	O
the	O
publishers	O
and	O
subscribers	O
but	O
also	O
decouple	O
them	O
temporally	O
.	O
</s>
<s>
A	O
common	O
strategy	O
used	O
by	O
middleware	O
analysts	O
with	O
such	O
pub/sub	B-Operating_System
systems	O
is	O
to	O
take	O
down	O
a	O
publisher	O
to	O
allow	O
the	O
subscriber	O
to	O
work	O
through	O
the	O
backlog	O
(	O
a	O
form	O
of	O
bandwidth	O
throttling	O
)	O
.	O
</s>
<s>
Pub/sub	B-Operating_System
provides	O
the	O
opportunity	O
for	O
better	O
scalability	B-Architecture
than	O
traditional	O
client-server	B-Operating_System
,	O
through	O
parallel	O
operation	O
,	O
message	O
caching	O
,	O
tree-based	O
or	O
network-based	O
routing	O
,	O
etc	O
.	O
</s>
<s>
However	O
,	O
in	O
certain	O
types	O
of	O
tightly	O
coupled	O
,	O
high-volume	O
enterprise	O
environments	O
,	O
as	O
systems	O
scale	O
up	O
to	O
become	O
data	O
centers	O
with	O
thousands	O
of	O
servers	O
sharing	O
the	O
pub/sub	B-Operating_System
infrastructure	O
,	O
current	O
vendor	O
systems	O
often	O
lose	O
this	O
benefit	O
;	O
scalability	B-Architecture
for	O
pub/sub	B-Operating_System
products	O
under	O
high	O
load	O
in	O
these	O
contexts	O
is	O
a	O
research	O
challenge	O
.	O
</s>
<s>
Outside	O
of	O
the	O
enterprise	O
environment	O
,	O
on	O
the	O
other	O
hand	O
,	O
the	O
pub/sub	B-Operating_System
paradigm	O
has	O
proven	O
its	O
scalability	B-Architecture
to	O
volumes	O
far	O
beyond	O
those	O
of	O
a	O
single	O
data	O
center	O
,	O
providing	O
Internet-wide	O
distributed	O
messaging	O
through	O
web	O
syndication	O
protocols	O
such	O
as	O
RSS	O
and	O
Atom	B-Application
.	O
</s>
<s>
These	O
syndication	O
protocols	O
accept	O
higher	O
latency	O
and	O
lack	O
of	O
delivery	O
guarantees	O
in	O
exchange	O
for	O
the	O
ability	O
for	O
even	O
a	O
low-end	O
web	O
server	O
to	O
syndicate	O
messages	B-Architecture
to	O
(	O
potentially	O
)	O
millions	O
of	O
separate	O
subscriber	O
nodes	O
.	O
</s>
<s>
The	O
most	O
serious	O
problems	O
with	O
pub/sub	B-Operating_System
systems	O
are	O
a	O
side-effect	O
of	O
their	O
main	O
advantage	O
:	O
the	O
decoupling	O
of	O
publisher	O
from	O
subscriber	O
.	O
</s>
<s>
A	O
pub/sub	B-Operating_System
system	O
must	O
be	O
designed	O
carefully	O
to	O
be	O
able	O
to	O
provide	O
stronger	O
system	O
properties	O
that	O
a	O
particular	O
application	O
might	O
require	O
,	O
such	O
as	O
assured	O
delivery	O
.	O
</s>
<s>
The	O
broker	O
in	O
a	O
pub/sub	B-Operating_System
system	O
may	O
be	O
designed	O
to	O
deliver	O
messages	B-Architecture
for	O
a	O
specified	O
time	O
,	O
but	O
then	O
stop	O
attempting	O
delivery	O
,	O
whether	O
or	O
not	O
it	O
has	O
received	O
confirmation	O
of	O
successful	O
receipt	O
of	O
the	O
message	O
by	O
all	O
subscribers	O
.	O
</s>
<s>
A	O
pub/sub	B-Operating_System
system	O
designed	O
in	O
this	O
way	O
cannot	O
guarantee	O
delivery	O
of	O
messages	B-Architecture
to	O
any	O
applications	O
that	O
might	O
require	O
such	O
assured	O
delivery	O
.	O
</s>
<s>
Tighter	O
coupling	O
of	O
the	O
designs	O
of	O
such	O
a	O
publisher	O
and	O
subscriber	O
pair	O
must	O
be	O
enforced	O
outside	O
of	O
the	O
pub/sub	B-Operating_System
architecture	O
to	O
accomplish	O
such	O
assured	O
delivery	O
(	O
e.g.	O
</s>
<s>
by	O
requiring	O
the	O
subscriber	O
to	O
publish	O
receipt	O
messages	B-Architecture
)	O
.	O
</s>
<s>
A	O
publisher	O
in	O
a	O
pub/sub	B-Operating_System
system	O
may	O
assume	O
that	O
a	O
subscriber	O
is	O
listening	O
,	O
when	O
in	O
fact	O
it	O
is	O
not	O
.	O
</s>
<s>
A	O
factory	O
may	O
utilize	O
a	O
pub/sub	B-Operating_System
system	O
where	O
equipment	O
can	O
publish	O
problems	O
or	O
failures	O
to	O
a	O
subscriber	O
that	O
displays	O
and	O
logs	O
those	O
problems	O
.	O
</s>
<s>
If	O
the	O
logger	O
fails	O
(	O
crashes	O
)	O
,	O
equipment	O
problem	O
publishers	O
wo	O
n't	O
necessarily	O
receive	O
notice	O
of	O
the	O
logger	O
failure	O
,	O
and	O
error	O
messages	B-Architecture
will	O
not	O
be	O
displayed	O
or	O
recorded	O
by	O
any	O
equipment	O
on	O
the	O
pub/sub	B-Operating_System
system	O
.	O
</s>
<s>
This	O
is	O
also	O
a	O
design	O
challenge	O
for	O
alternative	O
messaging	O
architectures	O
,	O
such	O
as	O
a	O
client/server	B-Operating_System
system	O
.	O
</s>
<s>
In	O
a	O
client/server	B-Operating_System
system	O
,	O
when	O
an	O
error	O
logger	O
fails	O
,	O
the	O
system	O
will	O
receive	O
an	O
indication	O
of	O
the	O
error	O
logger	O
(	O
server	O
)	O
failure	O
.	O
</s>
<s>
However	O
,	O
the	O
client/server	B-Operating_System
system	O
will	O
have	O
to	O
deal	O
with	O
that	O
failure	O
by	O
having	O
redundant	O
logging	O
servers	O
online	O
,	O
or	O
by	O
dynamically	O
spawning	O
fallback	O
logging	O
servers	O
.	O
</s>
<s>
This	O
adds	O
complexity	O
to	O
the	O
client	O
and	O
server	O
designs	O
,	O
as	O
well	O
as	O
to	O
the	O
client/server	B-Operating_System
architecture	I-Operating_System
as	O
a	O
whole	O
.	O
</s>
<s>
However	O
,	O
in	O
a	O
pub/sub	B-Operating_System
system	O
,	O
redundant	O
logging	O
subscribers	O
that	O
are	O
exact	O
duplicates	O
of	O
the	O
existing	O
logger	O
can	O
be	O
added	O
to	O
the	O
system	O
to	O
increase	O
logging	O
reliability	O
without	O
any	O
impact	O
to	O
any	O
other	O
equipment	O
on	O
the	O
system	O
.	O
</s>
<s>
In	O
a	O
pub/sub	B-Operating_System
system	O
,	O
the	O
feature	O
of	O
assured	O
error	O
message	O
logging	O
can	O
be	O
added	O
incrementally	O
,	O
subsequent	O
to	O
implementing	O
the	O
basic	O
functionality	O
of	O
equipment	O
problem	O
message	O
logging	O
.	O
</s>
<s>
The	O
pub/sub	B-Operating_System
pattern	O
scales	O
well	O
for	O
small	O
networks	O
with	O
a	O
small	O
number	O
of	O
publisher	O
and	O
subscriber	O
nodes	O
and	O
low	O
message	O
volume	O
.	O
</s>
<s>
However	O
,	O
as	O
the	O
number	O
of	O
nodes	O
and	O
messages	B-Architecture
grows	O
,	O
the	O
likelihood	O
of	O
instabilities	O
increases	O
,	O
limiting	O
the	O
maximum	O
scalability	B-Architecture
of	O
a	O
pub/sub	B-Operating_System
network	O
.	O
</s>
<s>
For	O
pub/sub	B-Operating_System
systems	O
that	O
use	O
brokers	O
(	O
servers	O
)	O
,	O
the	O
argument	O
for	O
a	O
broker	O
to	O
send	O
messages	B-Architecture
to	O
a	O
subscriber	O
is	O
in-band	B-General_Concept
,	O
and	O
can	O
be	O
subject	O
to	O
security	O
problems	O
.	O
</s>
<s>
An	O
unauthorized	O
publisher	O
may	O
be	O
able	O
to	O
introduce	O
incorrect	O
or	O
damaging	O
messages	B-Architecture
into	O
the	O
pub/sub	B-Operating_System
system	O
.	O
</s>
<s>
This	O
is	O
especially	O
true	O
with	O
systems	O
that	O
broadcast	B-Operating_System
or	O
multicast	O
their	O
messages	B-Architecture
.	O
</s>
<s>
Transport	B-Protocol
Layer	I-Protocol
Security	I-Protocol
(	O
SSL/TLS	B-Protocol
)	O
)	O
can	O
prevent	O
unauthorized	O
access	O
,	O
but	O
cannot	O
prevent	O
damaging	O
messages	B-Architecture
from	O
being	O
introduced	O
by	O
authorized	O
publishers	O
.	O
</s>
<s>
Architectures	O
other	O
than	O
pub/sub	B-Operating_System
,	O
such	O
as	O
client/server	B-Operating_System
systems	O
,	O
are	O
also	O
vulnerable	O
to	O
authorized	O
message	O
senders	O
that	O
behave	O
maliciously	O
.	O
</s>
