java.lang.Object
org.activemq.advisories.ProducerDemandAdvisor
- public class ProducerDemandAdvisor
- extends java.lang.Object
A ProducerDemandAdvisor is used to know when a destination is in demand.
Sometimes generating messages to send to a destination is very expensive
and the application would like to avoid producing messages if there are no
active consumers for the destination. There is a "demand" for messages
when a consumer does come active.
This object uses Advisory messages to know when consumer go active and
inactive.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private static final org.apache.commons.logging.Log log
destination
private final org.activemq.message.ActiveMQDestination destination
connection
private javax.jms.Connection connection
session
private javax.jms.Session session
started
private SynchronizedBoolean started
consumerCount
private int consumerCount
demandListener
private ProducerDemandListener demandListener
ProducerDemandAdvisor
public ProducerDemandAdvisor(javax.jms.Connection connection,
javax.jms.Destination destination)
throws javax.jms.JMSException
fireDemandEvent
private void fireDemandEvent()
isInDemand
public boolean isInDemand()
getDemandListener
public ProducerDemandListener getDemandListener()
setDemandListener
public void setDemandListener(ProducerDemandListener demandListener)
start
public void start()
throws javax.jms.JMSException
stop
public void stop()
throws javax.jms.JMSException
process
protected void process(javax.jms.Message msg)