Dynamic Versus Administered Subscribers
In the previous section, we created a durable subscriber named
Borrower1
:
TopicSubscriber subscriber = tSession.createDurableSubscriber(topic, "Borrower1");
Some JMS providers allow you to statically define the durable subscriber in the configuration file or admin interface. In this case, the durable subscriber is said to be an administered durable subscriber, meaning that the durable subscriber is statically defined and known by the JMS provider. However, suppose you needed to produce a temporary durable subscriber, say to gather mortgage rates for the next one or two days to do some trend analysis. It would be silly to have to modify the JMS provider configuration files for this simple request.
The JMS specification allows for durable subscribers to be defined
dynamically at runtime, without having to statically define them in your
JMS provider configuration files. These types of durable subscribers are
known as dynamic durable subscribers. For example,
if we were to define a new durable subscriber called BorrowerA
, we could simply do the
following:
TopicSubscriber subscriber = tSession.createDurableSubscriber(topic, "BorrowerA");
In this case, the BorrowerA
durable subscriber is not defined in the JMS provider and, therefore, is
not an administered durable subscriber. However, once the line of code
listed above executes, a new durable subscriber called BorrowerA
is created in the JMS provider and, therefore, will receive all rates published ...
Get Java Message Service, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.