Package org.apache.activemq.command
Class ConsumerInfo
- java.lang.Object
-
- org.apache.activemq.command.BaseCommand
-
- org.apache.activemq.command.ConsumerInfo
-
- All Implemented Interfaces:
Command
,DataStructure
,TransientInitializer
public class ConsumerInfo extends BaseCommand implements TransientInitializer
-
-
Field Summary
Fields Modifier and Type Field Description protected BooleanExpression
additionalPredicate
protected BrokerId[]
brokerPath
protected boolean
browser
protected String
clientId
protected ConsumerId
consumerId
protected int
currentPrefetchSize
static byte
DATA_STRUCTURE_TYPE
protected ActiveMQDestination
destination
protected boolean
dispatchAsync
protected boolean
exclusive
static byte
HIGH_PRIORITY
static byte
LOW_PRIORITY
protected int
maximumPendingMessageLimit
static byte
NETWORK_CONSUMER_PRIORITY
protected List<ConsumerId>
networkConsumerIds
protected boolean
networkSubscription
protected boolean
noLocal
protected boolean
noRangeAcks
static byte
NORMAL_PRIORITY
protected boolean
optimizedAcknowledge
protected int
prefetchSize
protected byte
priority
protected boolean
retroactive
protected String
selector
protected String
subscriptionName
-
Fields inherited from class org.apache.activemq.command.BaseCommand
commandId, responseRequired
-
-
Constructor Summary
Constructors Constructor Description ConsumerInfo()
ConsumerInfo(ConsumerId consumerId)
ConsumerInfo(SessionInfo sessionInfo, long consumerId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNetworkConsumerId(ConsumerId networkConsumerId)
void
clearAssignedGroupCount(ActiveMQDestination dest)
ConsumerInfo
copy()
void
copy(ConsumerInfo info)
RemoveInfo
createRemoveCommand()
void
decrementAssignedGroupCount(ActiveMQDestination dest)
boolean
equals(Object obj)
BooleanExpression
getAdditionalPredicate()
A transient additional predicate that can be used it inject additional predicates into the selector on the fly.long
getAssignedGroupCount(ActiveMQDestination dest)
BrokerId[]
getBrokerPath()
The route of brokers the command has moved through.String
getClientId()
Used to identify the id of a client connection.ConsumerId
getConsumerId()
Is used to uniquely identify the consumer to the broker.int
getCurrentPrefetchSize()
byte
getDataStructureType()
ActiveMQDestination
getDestination()
The destination that the consumer is interested in receiving messages from.long
getLastDeliveredSequenceId()
int
getMaximumPendingMessageLimit()
How many messages a broker will keep around, above the prefetch limit, for non-durable topics before starting to discard older messages.List<ConsumerId>
getNetworkConsumerIds()
ConsumerId[]
getNetworkConsumerPath()
Tracks the original subscription id that causes a subscription to percolate through a network when networkTTL > 1.int
getPrefetchSize()
How many messages a broker will send to the client without receiving an ack before he stops dispatching messages to the client.byte
getPriority()
The broker will avoid dispatching to a lower priority consumer if there are other higher priority consumers available to dispatch to.String
getSelector()
The JMS selector used to filter out messages that this consumer is interested in.String
getSubscriptionName()
Used to identify the name of a durable subscription.int
hashCode()
void
incrementAssignedGroupCount(ActiveMQDestination dest)
void
initTransients()
boolean
isBrowser()
Is this consumer a queue browser?boolean
isDispatchAsync()
Should the broker dispatch a message to the consumer async? If he does it async, then he uses a more SEDA style of processing while if it is not done async, then he broker use a STP style of processing.boolean
isDurable()
boolean
isExclusive()
An exclusive consumer locks out other consumers from being able to receive messages from the destination.boolean
isNetworkConsumersEmpty()
boolean
isNetworkSubscription()
boolean
isNoLocal()
Set noLocal to true to avoid receiving messages that were published locally on the same connection.boolean
isNoRangeAcks()
The broker may be able to optimize it's processing or provides better QOS if it knows the consumer will not be sending ranged acks.boolean
isOptimizedAcknowledge()
boolean
isRetroactive()
A retroactive consumer only has meaning for Topics.void
removeNetworkConsumerId(ConsumerId networkConsumerId)
void
setAdditionalPredicate(BooleanExpression additionalPredicate)
void
setBrokerPath(BrokerId[] brokerPath)
void
setBrowser(boolean browser)
void
setClientId(String clientId)
void
setConsumerId(ConsumerId consumerId)
void
setCurrentPrefetchSize(int currentPrefetchSize)
void
setDestination(ActiveMQDestination destination)
void
setDispatchAsync(boolean dispatchAsync)
void
setExclusive(boolean exclusive)
void
setLastDeliveredSequenceId(long lastDeliveredSequenceId)
void
setMaximumPendingMessageLimit(int maximumPendingMessageLimit)
void
setNetworkConsumerPath(ConsumerId[] consumerPath)
void
setNetworkSubscription(boolean networkSubscription)
void
setNoLocal(boolean noLocal)
void
setNoRangeAcks(boolean noRangeAcks)
void
setOptimizedAcknowledge(boolean optimizedAcknowledge)
void
setPrefetchSize(int prefetchSize)
void
setPriority(byte priority)
void
setRetroactive(boolean retroactive)
void
setSelector(String selector)
void
setSubscriptionName(String durableSubscriptionId)
String
toString()
Response
visit(CommandVisitor visitor)
-
Methods inherited from class org.apache.activemq.command.BaseCommand
copy, getCommandId, getFrom, getTo, isBrokerInfo, isConnectionControl, isConsumerControl, isMarshallAware, isMessage, isMessageAck, isMessageDispatch, isMessageDispatchNotification, isResponse, isResponseRequired, isShutdownInfo, isWireFormatInfo, setCommandId, setFrom, setResponseRequired, setTo, toString
-
-
-
-
Field Detail
-
DATA_STRUCTURE_TYPE
public static final byte DATA_STRUCTURE_TYPE
- See Also:
- Constant Field Values
-
HIGH_PRIORITY
public static final byte HIGH_PRIORITY
- See Also:
- Constant Field Values
-
NORMAL_PRIORITY
public static final byte NORMAL_PRIORITY
- See Also:
- Constant Field Values
-
NETWORK_CONSUMER_PRIORITY
public static final byte NETWORK_CONSUMER_PRIORITY
- See Also:
- Constant Field Values
-
LOW_PRIORITY
public static final byte LOW_PRIORITY
- See Also:
- Constant Field Values
-
consumerId
protected ConsumerId consumerId
-
destination
protected ActiveMQDestination destination
-
prefetchSize
protected int prefetchSize
-
maximumPendingMessageLimit
protected int maximumPendingMessageLimit
-
browser
protected boolean browser
-
dispatchAsync
protected boolean dispatchAsync
-
selector
protected String selector
-
clientId
protected String clientId
-
subscriptionName
protected String subscriptionName
-
noLocal
protected boolean noLocal
-
exclusive
protected boolean exclusive
-
retroactive
protected boolean retroactive
-
priority
protected byte priority
-
brokerPath
protected BrokerId[] brokerPath
-
optimizedAcknowledge
protected boolean optimizedAcknowledge
-
currentPrefetchSize
protected transient int currentPrefetchSize
-
noRangeAcks
protected boolean noRangeAcks
-
additionalPredicate
protected BooleanExpression additionalPredicate
-
networkSubscription
protected transient boolean networkSubscription
-
networkConsumerIds
protected transient List<ConsumerId> networkConsumerIds
-
-
Constructor Detail
-
ConsumerInfo
public ConsumerInfo()
-
ConsumerInfo
public ConsumerInfo(ConsumerId consumerId)
-
ConsumerInfo
public ConsumerInfo(SessionInfo sessionInfo, long consumerId)
-
-
Method Detail
-
copy
public ConsumerInfo copy()
-
copy
public void copy(ConsumerInfo info)
-
isDurable
public boolean isDurable()
-
getDataStructureType
public byte getDataStructureType()
- Specified by:
getDataStructureType
in interfaceDataStructure
- Returns:
- The type of the data structure
-
getConsumerId
public ConsumerId getConsumerId()
Is used to uniquely identify the consumer to the broker.
-
setConsumerId
public void setConsumerId(ConsumerId consumerId)
-
isBrowser
public boolean isBrowser()
Is this consumer a queue browser?
-
setBrowser
public void setBrowser(boolean browser)
-
getDestination
public ActiveMQDestination getDestination()
The destination that the consumer is interested in receiving messages from. This destination could be a composite destination.
-
setDestination
public void setDestination(ActiveMQDestination destination)
-
getPrefetchSize
public int getPrefetchSize()
How many messages a broker will send to the client without receiving an ack before he stops dispatching messages to the client.
-
setPrefetchSize
public void setPrefetchSize(int prefetchSize)
-
getMaximumPendingMessageLimit
public int getMaximumPendingMessageLimit()
How many messages a broker will keep around, above the prefetch limit, for non-durable topics before starting to discard older messages.
-
setMaximumPendingMessageLimit
public void setMaximumPendingMessageLimit(int maximumPendingMessageLimit)
-
isDispatchAsync
public boolean isDispatchAsync()
Should the broker dispatch a message to the consumer async? If he does it async, then he uses a more SEDA style of processing while if it is not done async, then he broker use a STP style of processing. STP is more appropriate in high bandwidth situations or when being used by and in vm transport.
-
setDispatchAsync
public void setDispatchAsync(boolean dispatchAsync)
-
getSelector
public String getSelector()
The JMS selector used to filter out messages that this consumer is interested in.
-
setSelector
public void setSelector(String selector)
-
getClientId
public String getClientId()
Used to identify the id of a client connection.
-
setClientId
public void setClientId(String clientId)
-
getSubscriptionName
public String getSubscriptionName()
Used to identify the name of a durable subscription.
-
setSubscriptionName
public void setSubscriptionName(String durableSubscriptionId)
-
isNoLocal
public boolean isNoLocal()
Set noLocal to true to avoid receiving messages that were published locally on the same connection.
-
setNoLocal
public void setNoLocal(boolean noLocal)
-
isExclusive
public boolean isExclusive()
An exclusive consumer locks out other consumers from being able to receive messages from the destination. If there are multiple exclusive consumers for a destination, the first one created will be the exclusive consumer of the destination.
-
setExclusive
public void setExclusive(boolean exclusive)
-
isRetroactive
public boolean isRetroactive()
A retroactive consumer only has meaning for Topics. It allows a consumer to retroactively see messages sent prior to the consumer being created. If the consumer is not durable, it will be delivered the last message published to the topic. If the consumer is durable then it will receive all persistent messages that are still stored in persistent storage for that topic.
-
setRetroactive
public void setRetroactive(boolean retroactive)
-
createRemoveCommand
public RemoveInfo createRemoveCommand()
-
getPriority
public byte getPriority()
The broker will avoid dispatching to a lower priority consumer if there are other higher priority consumers available to dispatch to. This allows letting the broker to have an affinity to higher priority consumers. Default priority is 0.
-
setPriority
public void setPriority(byte priority)
-
getBrokerPath
public BrokerId[] getBrokerPath()
The route of brokers the command has moved through.
-
setBrokerPath
public void setBrokerPath(BrokerId[] brokerPath)
-
getAdditionalPredicate
public BooleanExpression getAdditionalPredicate()
A transient additional predicate that can be used it inject additional predicates into the selector on the fly. Handy if if say a Security Broker interceptor wants to filter out messages based on security level of the consumer.
-
setAdditionalPredicate
public void setAdditionalPredicate(BooleanExpression additionalPredicate)
-
visit
public Response visit(CommandVisitor visitor) throws Exception
-
isNetworkSubscription
public boolean isNetworkSubscription()
- Returns:
- Returns the networkSubscription.
-
setNetworkSubscription
public void setNetworkSubscription(boolean networkSubscription)
- Parameters:
networkSubscription
- The networkSubscription to set.
-
isOptimizedAcknowledge
public boolean isOptimizedAcknowledge()
- Returns:
- Returns the optimizedAcknowledge.
-
setOptimizedAcknowledge
public void setOptimizedAcknowledge(boolean optimizedAcknowledge)
- Parameters:
optimizedAcknowledge
- The optimizedAcknowledge to set.
-
getCurrentPrefetchSize
public int getCurrentPrefetchSize()
- Returns:
- Returns the currentPrefetchSize.
-
setCurrentPrefetchSize
public void setCurrentPrefetchSize(int currentPrefetchSize)
- Parameters:
currentPrefetchSize
- The currentPrefetchSize to set.
-
isNoRangeAcks
public boolean isNoRangeAcks()
The broker may be able to optimize it's processing or provides better QOS if it knows the consumer will not be sending ranged acks.- Returns:
- true if the consumer will not send range acks.
-
setNoRangeAcks
public void setNoRangeAcks(boolean noRangeAcks)
-
addNetworkConsumerId
public void addNetworkConsumerId(ConsumerId networkConsumerId)
-
removeNetworkConsumerId
public void removeNetworkConsumerId(ConsumerId networkConsumerId)
-
isNetworkConsumersEmpty
public boolean isNetworkConsumersEmpty()
-
getNetworkConsumerIds
public List<ConsumerId> getNetworkConsumerIds()
-
getNetworkConsumerPath
public ConsumerId[] getNetworkConsumerPath()
Tracks the original subscription id that causes a subscription to percolate through a network when networkTTL > 1. Tracking the original subscription allows duplicate suppression.- Returns:
- array of the current subscription path
-
setNetworkConsumerPath
public void setNetworkConsumerPath(ConsumerId[] consumerPath)
-
setLastDeliveredSequenceId
public void setLastDeliveredSequenceId(long lastDeliveredSequenceId)
-
getLastDeliveredSequenceId
public long getLastDeliveredSequenceId()
-
incrementAssignedGroupCount
public void incrementAssignedGroupCount(ActiveMQDestination dest)
-
clearAssignedGroupCount
public void clearAssignedGroupCount(ActiveMQDestination dest)
-
decrementAssignedGroupCount
public void decrementAssignedGroupCount(ActiveMQDestination dest)
-
getAssignedGroupCount
public long getAssignedGroupCount(ActiveMQDestination dest)
-
initTransients
public void initTransients()
- Specified by:
initTransients
in interfaceTransientInitializer
-
toString
public String toString()
- Overrides:
toString
in classBaseCommand
-
-