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 voidbasicAck(Channel channel, long deliveryTag, boolean multiple)voidbasicCancel(Channel channel, String consumerTag)voidbasicConsume(Channel channel, String consumerTag, boolean autoAck)voidbasicNack(Channel channel, long deliveryTag)voidbasicPublish(Channel channel)voidbasicReject(Channel channel, long deliveryTag)voidcleanStaleState()Clean inner state for close connections and channels.voidcloseChannel(Channel channel)voidcloseConnection(Connection connection)voidconsumedMessage(Channel channel, long deliveryTag, boolean autoAck)voidconsumedMessage(Channel channel, long deliveryTag, String consumerTag)protected abstract voiddecrementChannelCount(Channel channel)Decrements channel count.protected abstract voiddecrementConnectionCount(Connection connection)Decrements connection count.protected abstract voidincrementChannelCount(Channel channel)Increments channel count.protected abstract voidincrementConnectionCount(Connection connection)Increments connection count.protected abstract voidmarkAcknowledgedMessage()Marks the event of an acknowledged message.protected abstract voidmarkConsumedMessage()Marks the event of a consumed message.protected abstract voidmarkPublishedMessage()Marks the event of a published message.protected abstract voidmarkRejectedMessage()Marks the event of a rejected message.voidnewChannel(Channel channel)voidnewConnection(Connection connection)
-
-
-
Method Detail
-
newConnection
public void newConnection(Connection connection)
- Specified by:
newConnectionin interfaceMetricsCollector
-
closeConnection
public void closeConnection(Connection connection)
- Specified by:
closeConnectionin interfaceMetricsCollector
-
newChannel
public void newChannel(Channel channel)
- Specified by:
newChannelin interfaceMetricsCollector
-
closeChannel
public void closeChannel(Channel channel)
- Specified by:
closeChannelin interfaceMetricsCollector
-
basicPublish
public void basicPublish(Channel channel)
- Specified by:
basicPublishin interfaceMetricsCollector
-
basicConsume
public void basicConsume(Channel channel, String consumerTag, boolean autoAck)
- Specified by:
basicConsumein interfaceMetricsCollector
-
basicCancel
public void basicCancel(Channel channel, String consumerTag)
- Specified by:
basicCancelin interfaceMetricsCollector
-
consumedMessage
public void consumedMessage(Channel channel, long deliveryTag, boolean autoAck)
- Specified by:
consumedMessagein interfaceMetricsCollector
-
consumedMessage
public void consumedMessage(Channel channel, long deliveryTag, String consumerTag)
- Specified by:
consumedMessagein interfaceMetricsCollector
-
basicAck
public void basicAck(Channel channel, long deliveryTag, boolean multiple)
- Specified by:
basicAckin interfaceMetricsCollector
-
basicNack
public void basicNack(Channel channel, long deliveryTag)
- Specified by:
basicNackin interfaceMetricsCollector
-
basicReject
public void basicReject(Channel channel, long deliveryTag)
- Specified by:
basicRejectin 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.
-
-