T - public abstract class QueueReport<T> extends Object
The QueueReport class provides an extension point for installations to provide custom management reporting on queues through the REST API.
A custom QueueReport must extend either QueueTextReport
or QueueBinaryReport. The report implementation must
define a name which is unique amongst all installed reports. The report class must be present
in the classpath of the broker, and a provider-configuration file named
org.apache.qpid.server.management.plugin.report.QueueReport must be added in the resource directory
META-INF/services directory with the binary name of the implementation (as described in
ServiceLoader).
The report can be run using the URL:
http://<broker>/service/queuereport/<virtualhost name>/<queue name>/<report name>[?param1=x¶m2=y...]
Reports can take parameters from the query string of the HTTP request. For every parameter in the query string
the system will look for a setter on the report object with either a String or String[] parameter. Thus if
the query string contains foo=bar, then the system will look for a setter setFoo(String value) or
setFoo(String[] value). If the same parameter occurs multiple times in the query string then only the
array variant of the setter will be called.
Setters for the parameters are guaranteed to be called before the first message is added to the report.
NOTE: In order to comply with the requirements of the ServiceLoader api, all
implementations of QueueReport MUST provide a public no-args constructor.
| Modifier and Type | Method and Description |
|---|---|
abstract void |
addMessage(ReportableMessage reportableMessage)
Called by the system to add a message to the report.
|
abstract String |
getContentType()
The value returned by getContentType() will be used to set the Content-Type HTTP header field
|
abstract String |
getName()
Gets the name of the report.
|
String |
getQueueName()
Get the name of the queue against which the report is being run.
|
abstract T |
getReport()
Called by the system to get the content of the report to retrun to the user.
|
String |
getVirtualHostName()
Get the name of the virtual host against which the report is being run.
|
abstract boolean |
isComplete()
Informs the system if the report is complete (i.e.
|
public abstract String getName()
The name of the report must be unique amongst all installed implementations. The name of the report is examined by the Qpid immediately upon construction. The name should not change during the lifetime of the object (the value is only meaningful to the system at the time of initial construction) and all instances of the same concrete implementation should have the same name.
public final String getQueueName()
public final String getVirtualHostName()
public abstract String getContentType()
public abstract void addMessage(ReportableMessage reportableMessage)
The method is called by the system for every message on the queue, or until isComplete() returns true.
reportableMessage - the message to add to the reportpublic abstract boolean isComplete()
This method will be called by the system after each message is added
to the report. If a report is only interested in some messages, and can determine that the addition of more
messages will not vary the content of the report, then it can return true.
If this method always returns false, then all messages from the queue will be added to the report.
NOTE: Retrieving content or properties of the message may require it to be reloaded from disk, and so care should be taken by reports to only access properties/content of the message if it is going to be required for the report production.
public abstract T getReport()
The system guarantees to only call this method once
Copyright © 2006–2015 The Apache Software Foundation. All rights reserved.