Package com.rabbitmq.client.impl
Class AbstractMetricsCollector
- java.lang.Object
-
- com.rabbitmq.client.impl.AbstractMetricsCollector
-
- All Implemented Interfaces:
MetricsCollector
- Direct Known Subclasses:
MicrometerMetricsCollector
,StandardMetricsCollector
public abstract class AbstractMetricsCollector extends Object implements MetricsCollector
Base class forMetricsCollector
. Implements tricky logic such as keeping track of acknowledged and rejected messages. Sub-classes just need to implement the logic to increment their metrics. Note transactions are not supported (seeMetricsCollector
.- See Also:
MetricsCollector
-
-
Constructor Summary
Constructors Constructor Description AbstractMetricsCollector()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
basicAck(Channel channel, long deliveryTag, boolean multiple)
void
basicCancel(Channel channel, String consumerTag)
void
basicConsume(Channel channel, String consumerTag, boolean autoAck)
void
basicNack(Channel channel, long deliveryTag)
void
basicPublish(Channel channel)
void
basicReject(Channel channel, long deliveryTag)
void
cleanStaleState()
Clean inner state for close connections and channels.void
closeChannel(Channel channel)
void
closeConnection(Connection connection)
void
consumedMessage(Channel channel, long deliveryTag, boolean autoAck)
void
consumedMessage(Channel channel, long deliveryTag, String consumerTag)
protected abstract void
decrementChannelCount(Channel channel)
Decrements channel count.protected abstract void
decrementConnectionCount(Connection connection)
Decrements connection count.protected abstract void
incrementChannelCount(Channel channel)
Increments channel count.protected abstract void
incrementConnectionCount(Connection connection)
Increments connection count.protected abstract void
markAcknowledgedMessage()
Marks the event of an acknowledged message.protected abstract void
markConsumedMessage()
Marks the event of a consumed message.protected abstract void
markPublishedMessage()
Marks the event of a published message.protected abstract void
markRejectedMessage()
Marks the event of a rejected message.void
newChannel(Channel channel)
void
newConnection(Connection connection)
-
-
-
Method Detail
-
newConnection
public void newConnection(Connection connection)
- Specified by:
newConnection
in interfaceMetricsCollector
-
closeConnection
public void closeConnection(Connection connection)
- Specified by:
closeConnection
in interfaceMetricsCollector
-
newChannel
public void newChannel(Channel channel)
- Specified by:
newChannel
in interfaceMetricsCollector
-
closeChannel
public void closeChannel(Channel channel)
- Specified by:
closeChannel
in interfaceMetricsCollector
-
basicPublish
public void basicPublish(Channel channel)
- Specified by:
basicPublish
in interfaceMetricsCollector
-
basicConsume
public void basicConsume(Channel channel, String consumerTag, boolean autoAck)
- Specified by:
basicConsume
in interfaceMetricsCollector
-
basicCancel
public void basicCancel(Channel channel, String consumerTag)
- Specified by:
basicCancel
in interfaceMetricsCollector
-
consumedMessage
public void consumedMessage(Channel channel, long deliveryTag, boolean autoAck)
- Specified by:
consumedMessage
in interfaceMetricsCollector
-
consumedMessage
public void consumedMessage(Channel channel, long deliveryTag, String consumerTag)
- Specified by:
consumedMessage
in interfaceMetricsCollector
-
basicAck
public void basicAck(Channel channel, long deliveryTag, boolean multiple)
- Specified by:
basicAck
in interfaceMetricsCollector
-
basicNack
public void basicNack(Channel channel, long deliveryTag)
- Specified by:
basicNack
in interfaceMetricsCollector
-
basicReject
public void basicReject(Channel channel, long deliveryTag)
- Specified by:
basicReject
in interfaceMetricsCollector
-
cleanStaleState
public void cleanStaleState()
Clean inner state for close connections and channels. Inner state is automatically cleaned on connection and channel closing. Thus, this method is provided as a safety net, to be externally called periodically if closing of resources wouldn't work properly for some corner cases.
-
incrementConnectionCount
protected abstract void incrementConnectionCount(Connection connection)
Increments connection count. The connection object is passed in as complementary information and without any guarantee of not being null.- Parameters:
connection
- the connection that has been created (can be null)
-
decrementConnectionCount
protected abstract void decrementConnectionCount(Connection connection)
Decrements connection count. The connection object is passed in as complementary information and without any guarantee of not being null.- Parameters:
connection
- the connection that has been closed (can be null)
-
incrementChannelCount
protected abstract void incrementChannelCount(Channel channel)
Increments channel count. The channel object is passed in as complementary information and without any guarantee of not being null.- Parameters:
channel
- the channel that has been created (can be null)
-
decrementChannelCount
protected abstract void decrementChannelCount(Channel channel)
Decrements channel count. The channel object is passed in as complementary information and without any guarantee of not being null.- Parameters:
channel
-
-
markPublishedMessage
protected abstract void markPublishedMessage()
Marks the event of a published message.
-
markConsumedMessage
protected abstract void markConsumedMessage()
Marks the event of a consumed message.
-
markAcknowledgedMessage
protected abstract void markAcknowledgedMessage()
Marks the event of an acknowledged message.
-
markRejectedMessage
protected abstract void markRejectedMessage()
Marks the event of a rejected message.
-
-