Author: chirino
Date: Mon Aug 29 00:31:48 2011
New Revision: 1162617
URL: http://svn.apache.org/viewvc?rev=1162617&view=rev
Log:
Fully documented all the resource routes and made a couple of their result
codes more consistent.
Modified:
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
activemq/activemq-apollo/trunk/apollo-website/ext/scalate/Boot.scala
activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md
Modified:
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala?rev=1162617&r1=1162616&r2=1162617&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
Mon Aug 29 00:31:48 2011
@@ -34,6 +34,7 @@ import java.util.{Collections, ArrayList
import org.apache.activemq.apollo.broker._
import java.security.Principal
import org.apache.activemq.apollo.dto._
+import javax.ws.rs.core.MediaType._
/**
* <p>
@@ -43,7 +44,7 @@ import org.apache.activemq.apollo.dto._
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
-@Produces(Array("application/json", "application/xml","text/xml",
"text/html;qs=5"))
+@Produces(Array(APPLICATION_JSON, APPLICATION_XML, TEXT_XML, "text/html;qs=5"))
case class BrokerResource() extends Resource {
@GET
@@ -324,7 +325,7 @@ case class BrokerResource() extends Reso
@GET @Path("virtual-hosts")
- @Produces(Array("application/json"))
+ @Produces(Array(APPLICATION_JSON))
def virtual_host(@QueryParam("f") f:java.util.List[String], @QueryParam("q")
q:String,
@QueryParam("p") p:java.lang.Integer, @QueryParam("ps")
ps:java.lang.Integer, @QueryParam("o") o:java.util.List[String] ):DataPageDTO =
{
@@ -490,7 +491,7 @@ case class BrokerResource() extends Reso
}
@GET @Path("virtual-hosts/{id}/topics")
- @Produces(Array("application/json"))
+ @Produces(Array(APPLICATION_JSON))
def topics(@PathParam("id") id : String, @QueryParam("f")
f:java.util.List[String],
@QueryParam("q") q:String, @QueryParam("p") p:java.lang.Integer,
@QueryParam("ps") ps:java.lang.Integer, @QueryParam("o")
o:java.util.List[String] ):DataPageDTO = {
with_virtual_host(id) { host =>
@@ -527,7 +528,7 @@ case class BrokerResource() extends Reso
}
@GET @Path("virtual-hosts/{id}/queues")
- @Produces(Array("application/json"))
+ @Produces(Array(APPLICATION_JSON))
def queues(@PathParam("id") id : String, @QueryParam("f")
f:java.util.List[String],
@QueryParam("q") q:String, @QueryParam("p") p:java.lang.Integer,
@QueryParam("ps") ps:java.lang.Integer, @QueryParam("o")
o:java.util.List[String] ):DataPageDTO = {
with_virtual_host(id) { host =>
@@ -555,7 +556,7 @@ case class BrokerResource() extends Reso
}
@DELETE @Path("virtual-hosts/{id}/queues/{name:.*}")
- @Produces(Array("application/json", "application/xml","text/xml"))
+ @Produces(Array(APPLICATION_JSON, APPLICATION_XML,TEXT_XML))
def queue_delete(@PathParam("id") id : String, @PathParam("name") name :
String):Unit = unwrap_future_result {
with_virtual_host(id) { host =>
val router: LocalRouter = host
@@ -574,7 +575,7 @@ case class BrokerResource() extends Reso
}
@GET @Path("virtual-hosts/{id}/dsubs")
- @Produces(Array("application/json"))
+ @Produces(Array(APPLICATION_JSON))
def durable_subscriptions(@PathParam("id") id : String, @QueryParam("f")
f:java.util.List[String],
@QueryParam("q") q:String, @QueryParam("p") p:java.lang.Integer,
@QueryParam("ps") ps:java.lang.Integer, @QueryParam("o")
o:java.util.List[String] ):DataPageDTO = {
with_virtual_host(id) { host =>
@@ -602,7 +603,7 @@ case class BrokerResource() extends Reso
@DELETE @Path("virtual-hosts/{id}/dsubs/{name:.*}")
- @Produces(Array("application/json", "application/xml","text/xml"))
+ @Produces(Array(APPLICATION_JSON, APPLICATION_XML,TEXT_XML))
def dsub_delete(@PathParam("id") id : String, @PathParam("name") name :
String):Unit = unwrap_future_result {
with_virtual_host(id) { host =>
val router: LocalRouter = host
@@ -638,7 +639,7 @@ case class BrokerResource() extends Reso
}
@GET @Path("connectors")
- @Produces(Array("application/json"))
+ @Produces(Array(APPLICATION_JSON))
def connectors(@QueryParam("f") f:java.util.List[String], @QueryParam("q")
q:String,
@QueryParam("p") p:java.lang.Integer, @QueryParam("ps")
ps:java.lang.Integer, @QueryParam("o") o:java.util.List[String] ):DataPageDTO =
{
@@ -662,36 +663,22 @@ case class BrokerResource() extends Reso
}
@POST @Path("connectors/{id}/action/stop")
- @Produces(Array("application/json", "application/xml","text/xml"))
def post_connector_stop(@PathParam("id") id : String):Unit =
unwrap_future_result {
with_connector(id) { connector =>
admining(connector.broker) {
connector.stop
}
}
- }
-
- @POST @Path("connectors/{id}/action/stop")
- @Produces(Array("text/html;qs=5"))
- def post_connector_stop_and_redirect(@PathParam("id") id : String):Unit =
unwrap_future_result {
- post_connector_stop(id)
result(strip_resolve(".."))
}
@POST @Path("connectors/{id}/action/start")
- @Produces(Array("application/json", "application/xml","text/xml"))
def post_connector_start(@PathParam("id") id : String):Unit =
unwrap_future_result {
with_connector(id) { connector =>
admining(connector.broker) {
connector.start
}
}
- }
-
- @POST @Path("connectors/{id}/action/start")
- @Produces(Array("text/html;qs=5"))
- def post_connector_start_and_redirect(@PathParam("id") id : String):Unit =
unwrap_future_result {
- post_connector_start(id)
result(strip_resolve(".."))
}
@@ -723,7 +710,7 @@ case class BrokerResource() extends Reso
@GET @Path("connections")
- @Produces(Array("application/json"))
+ @Produces(Array(APPLICATION_JSON))
def connections(@QueryParam("f") f:java.util.List[String], @QueryParam("q")
q:String,
@QueryParam("p") p:java.lang.Integer, @QueryParam("ps")
ps:java.lang.Integer, @QueryParam("o") o:java.util.List[String] ):DataPageDTO =
{
@@ -750,7 +737,7 @@ case class BrokerResource() extends Reso
}
@DELETE @Path("connections/{id}")
- @Produces(Array("application/json", "application/xml","text/xml"))
+ @Produces(Array(APPLICATION_JSON, APPLICATION_XML,TEXT_XML))
def connection_delete(@PathParam("id") id : Long):Unit =
unwrap_future_result {
with_connection(id){ connection=>
admining(connection.connector.broker) {
Modified:
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala?rev=1162617&r1=1162616&r2=1162617&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
Mon Aug 29 00:31:48 2011
@@ -22,7 +22,7 @@ import java.io.File
import org.apache.activemq.apollo.util.FileSupport._
import javax.ws.rs._
import javax.ws.rs.core.Response.Status._
-import com.sun.jersey.api.view.ImplicitProduces
+import javax.ws.rs.core.MediaType._
case class EditConfig(file:String, config:String, can_write:Boolean)
case class ListConfigs(files:Array[String])
@@ -43,7 +43,7 @@ case class ConfigurationResource(parent:
@GET
@Path("runtime")
- @Produces(Array("application/json", "application/xml","text/xml"))
+ @Produces(Array(APPLICATION_JSON, APPLICATION_XML, TEXT_XML))
def runtime = {
// Encode/Decode the runtime config so that we can get a copy that
@@ -62,7 +62,7 @@ case class ConfigurationResource(parent:
}
@GET
- @Produces(Array("application/json"))
+ @Produces(Array(APPLICATION_JSON))
@Path("files")
def list() = {
etc_directory.listFiles().flatMap { file =>
@@ -75,14 +75,14 @@ case class ConfigurationResource(parent:
}
@GET
- @Produces(Array("text/html"))
+ @Produces(Array(TEXT_HTML))
@Path("files")
def list_html() = {
ListConfigs(list())
}
@GET
- @Produces(Array("text/plain"))
+ @Produces(Array(APPLICATION_OCTET_STREAM))
@Path("files/{name}")
def get(@PathParam("name") name:String) = {
val file = etc_directory / name
@@ -93,7 +93,7 @@ case class ConfigurationResource(parent:
}
@GET
- @Produces(Array("text/html"))
+ @Produces(Array(TEXT_HTML))
@Path("files/{name}")
def edit_html(@PathParam("name") name:String) = {
val file = etc_directory / name
@@ -103,7 +103,8 @@ case class ConfigurationResource(parent:
EditConfig(name, file.read_text(), file.canWrite)
}
- @PUT
+ @POST
+ @Consumes(Array(WILDCARD))
@Path("files/{name}")
def put(@PathParam("name") name:String, config:Array[Byte]):Unit = {
val file = etc_directory / name
@@ -111,11 +112,13 @@ case class ConfigurationResource(parent:
result(NOT_FOUND)
}
file.write_bytes(config)
+ result(strip_resolve("."))
}
@POST
@Path("files/{name}")
- @Produces(Array("application/json", "application/xml","text/xml",
"text/html"))
+ @Consumes(Array(APPLICATION_FORM_URLENCODED))
+ @Produces(Array(APPLICATION_JSON, APPLICATION_XML,TEXT_XML, TEXT_HTML))
def edit_post(@PathParam("name") name:String, @FormParam("config")
config:String):Unit = {
put(name, config.getBytes("UTF-8"))
result(strip_resolve("."))
Modified:
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala?rev=1162617&r1=1162616&r2=1162617&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
Mon Aug 29 00:31:48 2011
@@ -22,6 +22,7 @@ import core.Response
import javax.servlet.http.HttpServletRequest
import com.sun.jersey.server.impl.ThreadLocalInvoker
import org.apache.activemq.apollo.web.WebModule
+import javax.ws.rs.core.MediaType._
/**
*
@@ -32,7 +33,7 @@ case class RootResource() extends Resour
import WebModule._
@GET
- @Produces(Array("application/json",
"application/xml","text/xml","text/html"))
+ @Produces(Array(APPLICATION_JSON, APPLICATION_XML,TEXT_XML,TEXT_HTML))
def post_connection_shutdown_and_redirect() = {
Response.seeOther(strip_resolve(root_redirect)).build
}
Modified: activemq/activemq-apollo/trunk/apollo-website/ext/scalate/Boot.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/ext/scalate/Boot.scala?rev=1162617&r1=1162616&r2=1162617&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-website/ext/scalate/Boot.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-website/ext/scalate/Boot.scala Mon
Aug 29 00:31:48 2011
@@ -19,7 +19,7 @@ package scalate
import org.fusesource.scalate.util.Logging
import java.util.concurrent.atomic.AtomicBoolean
import _root_.Website._
-import org.fusesource.scalate.TemplateEngine
+import org.fusesource.scalate._
import org.fusesource.scalamd.{MacroDefinition, Markdown}
import java.util.regex.Matcher
import org.fusesource.scalate.wikitext.Pygmentize
@@ -30,11 +30,23 @@ class Boot(engine: TemplateEngine) exten
def run: Unit = {
if (_initialised.compareAndSet(false, true)) {
+ def filter(m:Matcher):String = {
+ val filter_name = m.group(1)
+ val body = m.group(2)
+ engine.filter(filter_name) match {
+ case Some(filter)=>
+ filter.filter(RenderContext(), body)
+ case None=>
+ error("filter not found: "+filter_name)
+ body
+ }
+ }
def pygmentize(m:Matcher):String = Pygmentize.pygmentize(m.group(2),
m.group(1))
// add some macros to markdown.
Markdown.macros :::= List(
+ MacroDefinition("""\{filter::(.*?)\}(.*?)\{filter\}""", "s", filter,
true),
MacroDefinition("""\{pygmentize::(.*?)\}(.*?)\{pygmentize\}""", "s",
pygmentize, true),
MacroDefinition("""\{pygmentize\_and\_compare::(.*?)\}(.*?)\{pygmentize\_and\_compare\}""",
"s", pygmentize, true),
MacroDefinition("""\$\{project_version\}""", "", _ =>
project_version.toString, true),
Modified:
activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md?rev=1162617&r1=1162616&r2=1162617&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md
(original)
+++
activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md
Mon Aug 29 00:31:48 2011
@@ -19,7 +19,7 @@ since it is the same for every API call.
The broker requires all requests against the management API to supply
user credentials which have administration privileges.
-The user credentials should be supplied using via HTTP basic
+The user credentials can be supplied using via HTTP basic
authentication. Example:
$ curl -u "admin:password" http://localhost:61680/broker
@@ -39,6 +39,17 @@ Example:
$ curl -u "admin:password" http://localhost:61680/broker.json
+### Response Codes
+
+You can use the HTTP response code to determine if your request
+succeeded or failed. Expect the following:
+
+* *`200`*: If a GET, PUT, or DELETE request succeeds.
+* *`303`*: If a POST request succeeds.
+* *`404`*: If the resource cannot be found
+* *`401`*: If the user does not have access to the resource
+* *`50x`*: If an internal server error occurs while processing the request.
+
### Working with Tabular Results
Many of the resource routes provided by the broker implement
@@ -154,522 +165,559 @@ parameter to define the order in which t
'http://localhost:61680/broker/connections.json?o=write_counter%20DESC&o=id'
-### Broker Management
-
-The route for managing the broker is:
-
- /broker
-
-Doing a GET against it will provide information about the broker's
-
- * Version
- * Running State
- * Virtual Hosts
- * Connectors
- * Connections
-
-Example:
-
- $ curl -u "admin:password" \
- http://localhost:61680/broker.json
-
-Results in a [Broker
Status](./api/apollo-dto/org/apache/activemq/apollo/dto/BrokerStatusDTO.html) :
-
-{pygmentize:: js}
-{
- "version":"${project_version}",
- "id":"default",
- "state":"STARTED",
- "state_since":1305388053086,
- "current_time":1305388817653,
- "virtual_hosts":["localhost"],
- "connectors":[
- "stomps",
- "stomp"
- ],
- "connections":[
- {"id":24,"label":"/127.0.0.1:52603"},
- {"id":25,"label":"/127.0.0.1:52604"}
- ],
-}
-{pygmentize}
-
-### Connector Management
-
-The route for getting a tabular list of connectors is:
-
- /broker/connectors
-
-The route for managing a connector is:
-
- /broker/connectors/:id
-
-Example:
-
- $ curl -u "admin:password"
- http://localhost:61680/broker/connectors/stomp.json
-
-Results in a [Connector
Status](./api/apollo-dto/org/apache/activemq/apollo/dto/ConnectorStatusDTO.html):
-
-{pygmentize:: js}
-{
- "id":"stomp",
- "state":"STARTED",
- "state_since":1305553109899,
- "accepted":6,
- "connected":2
-}
-{pygmentize}
-
-To stop a connector send a POST to:
-
- /broker/connectors/:id/action/stop
-
-Example:
-
- curl -X POST -u "admin:password" \
- http://localhost:61680/broker/connectors/stomp/action/stop.json
-
-To start a stopped a connector send a POST to:
-
- /broker/connectors/:id/action/start
-
-Example:
-
- curl -X POST -u "admin:password" \
- http://localhost:61680/broker/connectors/stomp/action/start.json
-
-### Connection Management
-
-The route for getting a tabular list of connections is:
-
- /broker/connections
-
-The route for managing a single connection is:
-
- /broker/connections/:id
-
-Example:
-
- $ curl -u "admin:password" \
- http://localhost:61680/broker/connections/5.json
-
-Results in a [Connection
Status](./api/apollo-dto/org/apache/activemq/apollo/dto/ConnectionStatusDTO.html):
-
-{pygmentize:: js}
-{
- "id":"5",
- "state":"STARTED",
- "state_since":1305553686946,
- "read_counter":1401476017,
- "write_counter":99,
- "transport":"tcp",
- "protocol":"stomp",
- "remote_address":"/127.0.0.1:52638",
- "protocol_version":"1.0",
- "user":"admin",
- "waiting_on":"client request",
- "subscription_count":0
-}
-{pygmentize}
-
-To shutdown a connection, send a DELETE to
-
- /broker/connections/:id
-
-or send a POST to:
-
- /broker/connections/:id/action/delete
-
-Example:
-
- curl -X DELETE -u "admin:password" \
- http://localhost:61680/broker/connections/5.json
-
-
-### Virtual Host Management
-
-The route for managing a virtual host is:
-
- /broker/virtual-hosts/:name
-
-Where `:name` is the id of a virtual host configured in the broker.
-Example:
-
- $ curl -u "admin:password" \
- http://localhost:61680/broker/virtual-hosts/localhost.json
-
-Results in a [Virtual Host
Status](./api/apollo-dto/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.html):
-
-{pygmentize:: js}
-{
- "id":"localhost",
- "state":"STARTED",
- "state_since":1305390871786,
- "topics":[
- "item.prices",
- "inventory.level"
- ],
- "queues":[
- "orders.req",
- "orders.res",
- ],
- "store":true
-}
-{pygmentize}
-
-#### Virtual Host Store Management
-
-The route for managing a virtual host's Store is:
-
- /broker/virtual-hosts/:name/store
-
-Where `:name` is the id of a virtual host configured in the broker.
-
-Example:
-
- $ curl -u "admin:password" \
- http://localhost:61680/broker/virtual-hosts/localhost/store.json
-
-Results in a [Store
Status](./api/apollo-dto/org/apache/activemq/apollo/dto/StoreStatusDTO.html):
-
-{pygmentize:: js}
-{
- "@class":"org.apache.activemq.apollo.broker.store.bdb.dto.BDBStoreStatusDTO",
- "state":"STARTED",
- "state_since":1305554120954,
- "canceled_message_counter":87927,
- "flushed_message_counter":28576,
- "canceled_enqueue_counter":87927,
- "flushed_enqueue_counter":28576,
- "message_load_latency":{
- "count":0,
- "total":0,
- "max":0,
- "min":0
- },
- "flush_latency":{
- "count":0,
- "total":0,
- "max":0,
- "min":0
- },
- "journal_append_latency":null,
- "index_update_latency":null,
- "message_load_batch_size":{
- "count":0,
- "total":0,
- "max":-2147483648,
- "min":2147483647
- },
- "pending_stores":0
-}
-{pygmentize}
-
-#### Queue Management
-
-The route for getting a tabular list of queues is:
-
- /broker/virtual-hosts/:name/queues
-
-The route for managing a virtual host's Queue is:
-
- /broker/virtual-hosts/:name/queues/:qid
-
-Where `:name` is the id of a virtual host configured in the broker and `:qid`
is the id
-of the queue.
+### Reference
-Example:
-
- $ curl -u "admin:password" \
-
http://localhost:61680/broker/virtual-hosts/localhost/queues/orders.req.json
-
-Results in a [Queue
Status](./api/apollo-dto/org/apache/activemq/apollo/dto/QueueStatusDTO.html):
-
-{pygmentize:: js}
-{
- "id":"orders.req",
- "config":{
- "id":null,
- "unified":null,
- "producer_buffer":null,
- "queue_buffer":null,
- "consumer_buffer":null,
- "persistent":null,
- "swap":null,
- "swap_range_size":null,
- "acl":null
- },
- "binding":{
- "@class":"org.apache.activemq.apollo.dto.QueueDestinationDTO",
- "path":[
- "orders",
- "req"
- ]
- },
- "metrics":{
- "enqueue_item_counter":72292,
- "enqueue_size_counter":79943846,
- "enqueue_ts":1306433477839,
- "dequeue_item_counter":72144,
- "dequeue_size_counter":79780158,
- "dequeue_ts":1306433477839,
- "nack_item_counter":0,
- "nack_size_counter":0,
- "nack_ts":1306433476813,
- "queue_size":163688,
- "queue_items":148,
- "swapped_in_size":0,
- "swapped_in_items":0,
- "swapping_in_size":0,
- "swapping_out_size":0,
- "swapped_in_size_max":32768,
- "swap_out_item_counter":148,
- "swap_out_size_counter":163688,
- "swap_in_item_counter":0,
- "swap_in_size_counter":0
- },
- "entries":[
- ],
- "producers":[
- ],
- "consumers":[
- ]
-}
-{pygmentize}
-
-To delete a queue, send a DELETE to
-
- /broker/virtual-hosts/:name/queues/:qid
-
-or send a POST to:
-
- /broker/virtual-hosts/:name/queues/:qid/action/delete
-
-Example:
-
- curl -X DELETE -u "admin:password" \
-
http://localhost:61680/broker/virtual-hosts/localhost/queues/orders.req.json
-
-
-#### Topic Management
-
-The route for getting a tabular list of queues is:
-
- /broker/virtual-hosts/:name/topics
-
-The route for managing a virtual host's Topic is:
-
- /broker/virtual-hosts/:name/topics/:tid
-
-Where `:name` is the id of a virtual host configured in the broker and `:tid`
is the id
-of the topic.
-
-Example:
-
- $ curl -u "admin:password" \
-
http://localhost:61680/broker/virtual-hosts/localhost/topics/item.prices.json
-
-Results in a [Topic
Status](./api/apollo-dto/org/apache/activemq/apollo/dto/TopicStatusDTO.html):
-
-{pygmentize:: js}
-{
- "id":"item.prices",
- "config":{
- "id":null,
- "slow_consumer_policy":null,
- "acl":null
- },
- "producers":[
- {
- "kind":"connection",
- "id":"3",
- "label":"/127.0.0.1:52772"
+{filter::jade}
+- attributes("head") = capture
+ :css
+ table.reference tr th {
+ text-align:left;
}
- ],
- "consumers":[
- {
- "kind":"connection",
- "id":"4",
- "label":"/127.0.0.1:52773"
+ tr.even {
+ background-color: #eee;
+ }
+ table.reference tr td {
+ text-align:left;
+ padding: .4em;
+ vertical-align:top;
+ font-size:90%;
+ }
+ table.reference tr td p {
+ margin: 0 0 .5em 0;
+ }
+ td.methods {
+ font-weight:bold;
}
- ],
- "dsubs":[
- "mysubname"
- ]
-}
-{pygmentize}
-
-
-#### Durable Subscription Management
-
-The route for getting a tabular list of durable subscriptions is:
-
- /broker/virtual-hosts/:name/dsubs
-
-The route for managing a virtual host's durable subscription is:
-
- /broker/virtual-hosts/:name/dsubs/:sub
-
-Where `:name` is the id of a virtual host configured in the broker and `:sub`
is the id
-of the durable subscription.
-
-Example:
-
- $ curl -u "admin:password" \
- http://localhost:61680/broker/virtual-hosts/localhost/dsubs/mysub.json
-
-Results in a [Queue
Status](./api/apollo-dto/org/apache/activemq/apollo/dto/QueueStatusDTO.html):
-
-To delete a durable subscription, send a DELETE to
-
- /broker/virtual-hosts/:name/dsubs/:sub
-
-or send a POST to:
-
- /broker/virtual-hosts/:name/dsubs/:sub/action/delete
-
-Example:
-
- curl -X DELETE -u "admin:password" \
- http://localhost:61680/broker/virtual-hosts/localhost/dsubs/mysub.json
-
-
-### Getting the Broker's Configuration
-
-To get current runtime configuration of the broker GET:
-
- /broker/config/runtime
-
-Example:
-
- $ curl -u "admin:password" \
- http://localhost:61680/broker/config/runtime.json
-
-Results in a [Broker
Configuration](./api/apollo-dto/org/apache/activemq/apollo/dto/BrokerDTO.html):
-{pygmentize:: js}
-{
- "notes":"\n The default configuration with tls/ssl enabled.\n ",
- "virtual_hosts":[{
- "id":"apollo-a",
- "enabled":null,
- "host_names":["localhost"],
- "store":{
- "@class":"org.apache.activemq.apollo.broker.store.bdb.dto.BDBStoreDTO",
- "flush_delay":null,
- "directory":"/Users/chirino/opt/apollo-a/data",
- "read_threads":null,
- "zero_copy":null
- },
- "auto_create_destinations":null,
- "purge_on_startup":null,
- "topics":[],
- "queues":[],
- "dsubs":[],
- "regroup_connections":null,
- "acl":{
- "connects":[
- {"allow":"admins","deny":null,"kind":null}
- ]
- },
- "authentication":{
- "enabled":false,
- "domain":null,
- "acl_principal_kinds":[],
- "user_principal_kinds":[]
- },
- "router":null,
- "log_category":null
- }],
- "connectors":[{
- "id":"stomp",
- "enabled":null,
- "bind":"tcp://0.0.0.0:61613",
- "protocol":null,
- "connection_limit":2000,
- "protocols":[],"acl":null
- },{
- "id":"stomps",
- "enabled":null,
- "bind":"tls://0.0.0.0:61614",
- "protocol":null,
- "connection_limit":2000,
- "protocols":[],
- "acl":null
- }],
- "client_address":null,
- "key_storage":{
- "file":"/opt/apollo-a/etc/keystore",
- "password":null,
- "key_password":null,
- "store_type":null,
- "trust_algorithm":null,
- "key_algorithm":null
- },
- "acl":{
- "admins":[{
- "allow":"admins",
- "deny":null,
- "kind":null
- }]
- },
- "web_admins":[{
- "bind":"http://127.0.0.1:61680"
- }],
- "authentication":{
- "enabled":null,
- "domain":"apollo",
- "acl_principal_kinds":[],
- "user_principal_kinds":[]
- },
- "log_category":{
- "console":"console",
- "audit":"audit",
- "connection":"connection",
- "security":"security"
- },
- "sticky_dispatching":null
-}
-{pygmentize}
+- var even = false
+- def route(method:String, path:String, code:Int, dto:String=null,
code_desc:String=null, paging:String=null)(func: =>Unit)
+ - even = !even
+ tr(class={if(even) "even" else "odd"})
+ td.methods(rowspan="2")
+ code
+ = method
+ td.path
+ code
+ = path
+ td.codes
+ code
+ = code
+ - if( dto!=null )
+ and
+ a(href={website_base_url +
"/versions/"+project_version+"/website/documentation/api/apollo-dto/org/apache/activemq/apollo/dto/"+dto+".html"})
+ = dto
+ - if(code_desc!=null)
+ !~~ code_desc
+ - if( paging!=null )
+ paging
+ a(href={website_base_url +
"/versions/"+project_version+"/website/documentation/api/apollo-dto/org/apache/activemq/apollo/dto/"+paging+".html"})
+ = paging
+
+ tr(class={if(even) "even" else "odd"})
+ td.description(colspan="2")
+ !~~ capture(func)
+
+table.reference
+ tr
+ th
+ th Route
+ th On Success
+
+ - route("GET", "/broker.json", 200,"BrokerStatusDTO")
+ :markdown
+ General information about the broker, JVM, and OS status. Example:
-### Aggregate Queue Statistics
-
-You can get aggregate queue statistics at either the broker or virtual host
level by
-using one of the following URL routes:
-
- /broker/queue-metrics
- /broker/virtual-hosts/:name/queue-metrics
-
-Example:
-
- $ curl -u "admin:password" \
- http://localhost:61680/broker/queue-metrics.json
-
-Results in an [Aggregate of Queue
Metrics](./api/apollo-dto/org/apache/activemq/apollo/dto/AggregateQueueMetricsDTO.html):
+ `curl -u "admin:password" http://localhost:61680/broker.json`
+ {pygmentize:: js}
+ {
+ "id": "default",
+ "state": "STARTED",
+ "state_since": 1314573353753,
+ "version": "${project_version}",
+ "jvm_metrics": {
+ "heap_memory": {
+ "used": 22165160,
+ "alloc": 162201600,
+ "max": 954466304
+ },
+ "non_heap_memory": {
+ "used": 44522128,
+ "alloc": 45944832,
+ "max": 136314880
+ },
+ "classes_loaded": 5776,
+ "classes_unloaded": 0,
+ "threads_current": 21,
+ "threads_peak": 22,
+ "os_arch": "x86_64",
+ "os_name": "Mac OS X 10.7",
+ "os_memory_total": 8589934592,
+ "os_memory_free": 3339231232,
+ "os_swap_total": 0,
+ "os_swap_free": 2147483648,
+ "os_fd_open": 111,
+ "os_fd_max": 10240,
+ "os_load_average": 0.99267578125,
+ "os_cpu_time": 5630000000,
+ "os_processors": 4,
+ "runtime_name": "[email protected]",
+ "jvm_name": "Java HotSpot(TM) 64-Bit Server VM 1.6.0_26 (Apple
Inc.)",
+ "uptime": 37761,
+ "start_time": 1314573351000
+ },
+ "current_time": 1314573388707,
+ "virtual_hosts": ["default"],
+ "connectors": ["tls", "tcp"],
+ "connections": [],
+ "connection_counter": 0
+ }
+ {pygmentize}
+
+ - route("GET", "/broker/queue-metrics.json", 200, "AggregateDestMetricsDTO")
+ :markdown
+ Aggregates the messaging metrics for all the queue destinations.
Example:
+
+ `curl -u "admin:password"
http://localhost:61680/broker/queue-metrics.json`
+ {pygmentize:: js}
+ {
+ "current_time": 1314573698381,
+ "enqueue_item_counter": 57343,
+ "enqueue_size_counter": 63128582,
+ "enqueue_ts": 1314573698478,
+ "dequeue_item_counter": 55121,
+ "dequeue_size_counter": 60681503,
+ "dequeue_ts": 1314573698478,
+ "producer_counter": 22,
+ "consumer_counter": 16,
+ "producer_count": 22,
+ "consumer_count": 16,
+ "expired_item_counter": 0,
+ "expired_size_counter": 0,
+ "expired_ts": 1314573695015,
+ "nack_item_counter": 0,
+ "nack_size_counter": 0,
+ "nack_ts": 1314573695015,
+ "queue_size": 2447079,
+ "queue_items": 2222,
+ "swapped_in_size_max": 5963776,
+ "swapped_in_size": 5278341,
+ "swapped_in_items": 4794,
+ "swapping_in_size": 0,
+ "swapping_out_size": 0,
+ "swap_out_item_counter": 60,
+ "swap_out_size_counter": 65931,
+ "swap_in_item_counter": 60,
+ "swap_in_size_counter": 65931,
+ "objects": 10
+ }
+ {pygmentize}
+
+ - route("GET", "/broker/topic-metrics.json", 200, "AggregateDestMetricsDTO")
+ :markdown
+ Aggregates the messaging metrics for all the topic destinations
+
+ - route("GET", "/broker/dsub-metrics.json", 200, "AggregateDestMetricsDTO")
+ :markdown
+ Aggregates the messaging metrics for all the durable subscription
destinations
+
+ - route("GET", "/broker/dest-metrics.json", 200, "AggregateDestMetricsDTO")
+ :markdown
+ Aggregates the messaging metrics for all the destinations
+
+ - route("GET", "/broker/virtual-hosts.json", 200, "DataPageDTO", null,
"VirtualHostStatusDTO")
+ :markdown
+ Provides tabular access to all the virtual hosts.
+
+ - route("GET", "/broker/virtual-hosts/{host}.json", 200,
"VirtualHostStatusDTO")
+ :markdown
+ General details about the `{host}` virtual host. Example:
+
+ `curl -u "admin:password"
http://localhost:61680/broker/virtual-hosts/default.json`
+ {pygmentize:: js}
+ {
+ "id": "default",
+ "state": "STARTED",
+ "state_since": 1314573798989,
+ "topics": [],
+ "queues": ["example-4", "example-7", "example-6", "example-0",
+ "example-3", "example-8", "example-1", "example-5",
+ "example-9", "example-2"],
+ "dsubs": [],
+ "store": true,
+ "host_names": ["default", "localhost", "127.0.0.1"]
+ }
+ {pygmentize}
+
+ - route("GET", "/broker/virtual-hosts/{host}/queue-metrics.json", 200,
"AggregateDestMetricsDTO")
+ :markdown
+ Aggregates the messaging metrics for all the queue destinations on the
+ `{host}` virtual host.
+
+ - route("GET", "/broker/virtual-hosts/{host}/topic-metrics.json", 200,
"AggregateDestMetricsDTO")
+ :markdown
+ Aggregates the messaging metrics for all the topic destinations on the
+ `{host}` virtual host.
+
+ - route("GET", "/broker/virtual-hosts/{host}/dsub-metrics.json", 200,
"AggregateDestMetricsDTO")
+ :markdown
+ Aggregates the messaging metrics for all the durable subscription
destinations on the
+ `{host}` virtual host.
+
+ - route("GET", "/broker/virtual-hosts/{host}/dest-metrics.json", 200,
"AggregateDestMetricsDTO")
+ :markdown
+ Aggregates the messaging metrics for all the destinations on the
+ `{host}` virtual host.
+
+ - route("GET", "/broker/virtual-hosts/{host}/store.json", 200,
"StoreStatusDTO", " sub class (depends on the store implementation)")
+ :markdown
+ Gets metrics about the status of the message store used by the `{host}`
virtual host. Example:
+
+ `curl -u "admin:password"
http://localhost:61680/broker/virtual-hosts/default/store.json`
+ {pygmentize:: js}
+ {
+ "@class":
"org.apache.activemq.apollo.broker.store.bdb.dto.BDBStoreStatusDTO",
+ "id": "bdb store at /Users/chirino/opt/default/data",
+ "state": "STARTED",
+ "state_since": 1314573798939,
+ "canceled_message_counter": 0,
+ "flushed_message_counter": 581034,
+ "canceled_enqueue_counter": 0,
+ "flushed_enqueue_counter": 581034,
+ "message_load_latency": {
+ "count": 0,
+ "total": 0,
+ "max": 0,
+ "min": 0
+ },
+ "flush_latency": {
+ "count": 0,
+ "total": 0,
+ "max": 0,
+ "min": 0
+ },
+ "pending_stores": 0,
+ "message_load_batch_size": {
+ "count": 0,
+ "total": 0,
+ "max": -2147483648,
+ "min": 2147483647
+ }
+ }
+ {pygmentize}
+
+
+ - route("GET", "/broker/virtual-hosts/{host}/queues.json", 200,
"DataPageDTO", null, "QueueStatusDTO")
+ :markdown
+ Provides tabular access to all queue destinations on the `{host}`
virtual host.
+
+ - route("GET", "/broker/virtual-hosts/{host}/queues/{dest}.json", 200,
"QueueStatusDTO")
+ :markdown
+ Gets metrics and details about the `{dest}` queue on the `{host}`
virtual host. Example:
+
+ `curl -u "admin:password"
http://localhost:61680/broker/virtual-hosts/default/queues/example-5.json`
+ {pygmentize:: js}
+ {
+ "id": "example-5",
+ "state": "STARTED",
+ "state_since": 1314573814532,
+ "config": {
+ "other": []
+ },
+ "binding": {
+ "@class": "org.apache.activemq.apollo.dto.QueueDestinationDTO",
+ "path": ["example-5"]
+ },
+ "metrics": {
+ "current_time": 1314574273342,
+ "enqueue_item_counter": 878638,
+ "enqueue_size_counter": 975430031,
+ "enqueue_ts": 1314574273335,
+ "dequeue_item_counter": 878522,
+ "dequeue_size_counter": 975301271,
+ "dequeue_ts": 1314574273328,
+ "producer_counter": 4,
+ "consumer_counter": 4,
+ "producer_count": 2,
+ "consumer_count": 2,
+ "expired_item_counter": 0,
+ "expired_size_counter": 0,
+ "expired_ts": 1314573814488,
+ "nack_item_counter": 118,
+ "nack_size_counter": 131098,
+ "nack_ts": 1314573928240,
+ "queue_size": 128760,
+ "queue_items": 116,
+ "swapped_in_size_max": 688128,
+ "swapped_in_size": 688200,
+ "swapped_in_items": 620,
+ "swapping_in_size": 0,
+ "swapping_out_size": 0,
+ "swap_out_item_counter": 605,
+ "swap_out_size_counter": 671279,
+ "swap_in_item_counter": 605,
+ "swap_in_size_counter": 671279
+ },
+ "entries": [],
+ "producers": [{
+ "kind": "connection",
+ "id": "43",
+ "label": "/127.0.0.1:51632",
+ "enqueue_item_counter": 12168,
+ "enqueue_size_counter": 13495374,
+ "enqueue_ts": 1314574273328
+ },
+ {
+ "kind": "connection",
+ "id": "76",
+ "label": "/127.0.0.1:51665",
+ "enqueue_item_counter": 13663,
+ "enqueue_size_counter": 15154824,
+ "enqueue_ts": 1314574273336
+ }],
+ "consumers": [{
+ "kind": "connection",
+ "id": "65",
+ "label": "/127.0.0.1:51654",
+ "enqueue_item_counter": 12678,
+ "enqueue_size_counter": 14060805,
+ "enqueue_ts": 1314574273248,
+ "position": 878615,
+ "acquired_count": 60,
+ "acquired_size": 66600,
+ "total_ack_count": 12618,
+ "total_nack_count": 0,
+ "waiting_on": "ack"
+ },
+ {
+ "kind": "connection",
+ "id": "75",
+ "label": "/127.0.0.1:51664",
+ "enqueue_item_counter": 13397,
+ "enqueue_size_counter": 14860500,
+ "enqueue_ts": 1314574273248,
+ "position": 878639,
+ "acquired_count": 56,
+ "acquired_size": 62160,
+ "total_ack_count": 13341,
+ "total_nack_count": 0,
+ "waiting_on": "producer"
+ }]
+ }
+ {pygmentize}
+
+
+ - route("DELETE", "/broker/virtual-hosts/{host}/queues/{dest}.json", 200)
+ :markdown
+ Deletes the `{dest}` queue on the `{host}` virtual host.
+
+ - route("GET", "/broker/virtual-hosts/{host}/topics.json", 200,
"DataPageDTO", null, "TopicStatusDTO")
+ :markdown
+ Provides tabular access to all topic destinations on the `{host}`
virtual host.
+
+ - route("GET", "/broker/virtual-hosts/{host}/topics/{dest}.json", 200,
"TopicStatusDTO")
+ :markdown
+ Gets metrics and details about the `{dest}` topic on the `{host}`
virtual host. Example:
+
+ `curl -u "admin:password"
http://localhost:61680/broker/virtual-hosts/default/topics/example-2.json`
+ {pygmentize:: js}
+ {
+ "id": "example-2",
+ "state": "STARTED",
+ "state_since": 1314574398831,
+ "config": {
+ "other": []
+ },
+ "producers": [{
+ "kind": "connection",
+ "id": "78",
+ "label": "/127.0.0.1:51668",
+ "enqueue_item_counter": 1133674,
+ "enqueue_size_counter": 1259289609,
+ "enqueue_ts": 1314574422110
+ }],
+ "consumers": [{
+ "kind": "connection",
+ "id": "86",
+ "label": "/127.0.0.1:51677",
+ "enqueue_item_counter": 566836,
+ "enqueue_size_counter": 629643696,
+ "enqueue_ts": 1314574422110
+ },
+ {
+ "kind": "connection",
+ "id": "82",
+ "label": "/127.0.0.1:51673",
+ "enqueue_item_counter": 566838,
+ "enqueue_size_counter": 629645913,
+ "enqueue_ts": 1314574422110
+ }],
+ "dsubs": [],
+ "metrics": {
+ "current_time": 0,
+ "enqueue_item_counter": 1133674,
+ "enqueue_size_counter": 1259289609,
+ "enqueue_ts": 1314574422110,
+ "dequeue_item_counter": 1133674,
+ "dequeue_size_counter": 1259289609,
+ "dequeue_ts": 1314574422110,
+ "producer_counter": 1,
+ "consumer_counter": 2,
+ "producer_count": 1,
+ "consumer_count": 2,
+ "expired_item_counter": 0,
+ "expired_size_counter": 0,
+ "expired_ts": 0,
+ "nack_item_counter": 0,
+ "nack_size_counter": 0,
+ "nack_ts": 0,
+ "queue_size": 0,
+ "queue_items": 0,
+ "swapped_in_size_max": 0,
+ "swapped_in_size": 0,
+ "swapped_in_items": 0,
+ "swapping_in_size": 0,
+ "swapping_out_size": 0,
+ "swap_out_item_counter": 0,
+ "swap_out_size_counter": 0,
+ "swap_in_item_counter": 0,
+ "swap_in_size_counter": 0
+ }
+ }
+ {pygmentize}
+
+ - route("GET",
"/broker/virtual-hosts/{host}/topic-queues/{dest}/{queue}.json", 200,
"QueueStatusDTO")
+ :markdown
+ Gets metrics and details about `{queue}` consumer queue which is being
used to
+ spool messages being sent to the `{dest}` topic on the `{host}` virtual
host.
+
+ - route("GET", "/broker/virtual-hosts/{host}/dsubs.json", 200,
"DataPageDTO", null, "QueueStatusDTO")
+ :markdown
+ Provides tabular access to all durable subscription destinations on the
`{host}` virtual host.
+
+ - route("GET", "/broker/virtual-hosts/{host}/dsubs/{dest}.json", 200,
"QueueStatusDTO")
+ :markdown
+ Gets metrics and details about the `{dest}` durable subscription on the
`{host}` virtual host.
+
+ - route("GET", "/broker/connectors.json", 200, "DataPageDTO", null,
"ServiceStatusDTO")
+ :markdown
+ Provides tabular access to all connectors on the broker.
+
+ - route("GET", "/broker/connectors/{connector}.json", 200,
"ServiceStatusDTO")
+ :markdown
+ Gets details about the `{connector}`. Example:
+
+ `curl -u "admin:password"
http://localhost:61680/broker/connectors/tcp.json`
+ {pygmentize:: js}
+ {
+ "id": "tcp",
+ "state": "STARTED",
+ "state_since": 1314573798510,
+ "local_address": "/0.0.0.0:61613",
+ "protocol": "any",
+ "connection_counter": 100,
+ "connected": 12
+ }
+ {pygmentize}
+
+ - route("POST", "/broker/connectors/{connector}/action/stop.json", 303)
+ :markdown
+ Stops the `{connector}`.
+
+ - route("POST", "/broker/connectors/{connector}/action/start.json", 303)
+ :markdown
+ Starts the `{connector}`.
+
+ - route("GET", "/broker/connection-metrics.json", 200,
"AggregateConnectionMetricsDTO")
+ :markdown
+ Aggregates metrics about the connections.
+
+ - route("GET", "/broker/connections.json", 200, "DataPageDTO", null,
"ConnectionStatusDTO")
+ :markdown
+ Provides tabular access to all connections on the broker.
+
+ - route("GET", "/broker/connections/{connection}.json", 200,
"ConnectionStatusDTO")
+ :markdown
+ Gets details about the `{connection}`. Example:
+
+ `curl -u "admin:password"
http://localhost:61680/broker/connections/108.json`
+ {pygmentize:: js}
+ {
+ "id": "108",
+ "state": "STARTED",
+ "state_since": 1314574636579,
+ "last_read_size": 0,
+ "last_write_size": 32973,
+ "read_counter": 106,
+ "write_counter": 632923992,
+ "transport": "tcp",
+ "protocol": "stomp",
+ "protocol_version": "1.0",
+ "remote_address": "/127.0.0.1:51733",
+ "local_address": "/127.0.0.1:61613",
+ "user": "admin",
+ "waiting_on": "client request",
+ "subscription_count": 1
+ }
+ {pygmentize}
+
+ - route("DELETE", "/broker/connections/{connection}.json", 200)
+ :markdown
+ Deletes the `{connection}`.
+
+ - route("POST", "/broker/connections/{connection}/action/delete.json", 303)
+ :markdown
+ Deletes the `{connection}`.
+
+ - route("POST", "/broker/action/shutdown.json", 303)
+ :markdown
+ Shuts down the JVM.
+
+ - route("GET", "/config/runtime.json", 200,"BrokerDTO")
+ :markdown
+ The runtime configuration the broker using. This version
+ of the configuration has all property placeholders resolved
+ and then password fields are cleared.
+
+ - route("GET", "/config/runtime.json", 200,"BrokerDTO")
+ :markdown
+ The runtime configuration the broker using. This version
+ of the configuration has all property placeholders resolved
+ and then password fields are cleared.
+ - route("GET", "/config/files.json", 200, null, "string array")
+ :markdown
+ A listing of the configuration files.
+ - route("GET", "/config/files/{file}", 200, null, "bytes")
+ :markdown
+ Downloads the contents of the config file.
+ - route("POST", "/config/files/{file}", 303)
+ :markdown
+ Updates the contents of the config file. You can either post the raw
bytes,
+ or form encoded with a field `config` set to the contents of the file.
+
+ - route("GET", "/broker/whoami.json", 200,"PrincipalDTO", "array")
+ :markdown
+ Lists the principals associated with your username. Example:
+ curl -u "admin:password" http://localhost:61680/broker/whoami.json
+ {pygmentize:: js}
+ [{
+ "name": "admin",
+ "kind": "org.apache.activemq.jaas.UserPrincipal"
+ }, {
+ "name": "admins",
+ "kind": "org.apache.activemq.jaas.GroupPrincipal"
+ }]
+ {pygmentize}
+
+ - route("GET", "/broker/signin.json", 200, null, "true")
+ :markdown
+ Log you in using the `username` and `password` query parameters.
+ creates a cookie based session.
+ - route("POST", "/broker/signin.json", 200, null, "true")
+ :markdown
+ Signs you in using the `username` and `password` form parameters.
+ Creates a cookie based session.
+ - route("GET", "/broker/signout.json", 200, null, "true")
+ :markdown
+ Signs you off by invalidating your session.
-{pygmentize:: js}
-{
- "enqueue_item_counter":0,
- "enqueue_size_counter":0,
- "enqueue_ts":0,
- "dequeue_item_counter":0,
- "dequeue_size_counter":0,
- "dequeue_ts":0,
- "nack_item_counter":0,
- "nack_size_counter":0,
- "nack_ts":0,
- "queue_size":0,
- "queue_items":0,
- "swapped_in_size":0,
- "swapped_in_items":0,
- "swapping_in_size":0,
- "swapping_out_size":0,
- "swapped_in_size_max":0,
- "swap_out_item_counter":0,
- "swap_out_size_counter":0,
- "swap_in_item_counter":0,
- "swap_in_size_counter":0,
- "queues":0
-}
-{pygmentize}
+{filter}