Skip to content

Notification Protocol

Roland Huß edited this page Oct 18, 2015 · 1 revision

Jolokia Notification Protocol

For supporting the management of notifications, the Jolokia Protocol received an new request type notification. This request type supports multiple (sub-) commands

  • A client must register (register) itself and receives a client id as well the names of the support notification backends. (Notifications are delivered via notification backends which do this independent from the Jolokia protocol)
  • With this client id he can subscribe (add) for notifications and gets back a notification handle. When subscribing, the MBean delivering the notifications and the name of the notification backend must be given, too.
  • For unsubscribing (remove) a client needs to provide the client id and the handle.
  • Unregistering (unregister) relesase all resources in the Jolokia agent associated with this client.
  • The current registered subscriptions can be listed (list).
  • From time to time a client needs to ping (ping) the Jolokia agent in order to avoid being cleaned up automatically. The notification backends can "refresh" the last access time when a notification has been delivered successfully.

register

  • Request
{
   "command": "register",
   "type": "notification"
}
http://localhost:8080/jolokia/notification/register
  • Response
{
    "timestamp": 1364115795,
    "status": 200,
    "request": {
        "command": "register",
        "type": "notification"
    },
    "value": {
        "id": "3dd164bf-22c6-4f60-b02d-564804f83c07",
        "backend": {
            "pull": {
                "store": "jolokia:type=NotificationStore,agent=61e79137-servlet",
                "maxEntries": 100
            }
        }
    }
}

unregister

  • Request
{
   "client": "3dd164bf-22c6-4f60-b02d-564804f83c07",
   "command": "unregister",
   "type": "notification"
}
http://localhost:8080/jolokia/notification/unregister/3dd164bf-22c6-4f60-b02d-564804f83c07
  • Response
{
    "timestamp": 1364115984,
    "status": 200,
    "request": {
        "client": "3dd164bf-22c6-4f60-b02d-564804f83c07",
        "command": "unregister",
        "type": "notification"
    },
    "value": null
}

add

  • Request
{
   "type": "notification",
   "command": "add",
   "client": "f529fd55-7f4c-4e4d-92a0-275eae36a2c1",
   "mode": "pull",
   "mbean": "java.lang:type=Memory",
   "filter": [
       "java.management.memory.threshold.exceeded"
   ],
   "config": {
        "myConfig": "extra config information"
   },
   "handback": "handback"
}
http://localhost:8080/jolokia/notification/add/f529fd55-7f4c-4e4d-92a0-275eae36a2c1/pull/java.lang:type=Memory/java.management.memory.threshold.exceeded/{"myConfig": "extra config information"}/handback
  • Response
{
    "timestamp": 1364117226,
    "status": 200,
    "request": {
        "mbean": "java.lang:type=Memory",
        "client": "f529fd55-7f4c-4e4d-92a0-275eae36a2c1",
        "handback": "handback",
        "command": "add",
        "config": {
            "myConfig": "extra config information"
        },
        "type": "notification",
        "filter": [
            "java.management.memory.threshold.exceeded"
        ],
        "mode": "pull"
    },
    "value": "2"
}

remove

  • Request
{
    "type": "notification",
    "command": "remove",
    "client": "f529fd55-7f4c-4e4d-92a0-275eae36a2c1",
    "handle": "2"
}
http://localhost:8080/jolokia/notification/remove/f529fd55-7f4c-4e4d-92a0-275eae36a2c1/2
  • Response
{
    "timestamp": 1364117636,
    "status": 200,
    "request": {
        "handle": "2",
        "client": "f529fd55-7f4c-4e4d-92a0-275eae36a2c1",
        "command": "remove",
        "type": "notification"
    },
    "value": null
}

ping

  • Request
{
    "type": "notification",
    "command": "ping",
    "client": "f529fd55-7f4c-4e4d-92a0-275eae36a2c1"
}
http://localhost:8080/jolokia/notification/ping/f529fd55-7f4c-4e4d-92a0-275eae36a2c1
  • Response
{
    "timestamp": 1364117795,
    "status": 200,
    "request": {
        "client": "f529fd55-7f4c-4e4d-92a0-275eae36a2c1",
        "command": "ping",
        "type": "notification"
    },
    "value": null
}

list

  • Request
{
    "type": "notification",
    "command": "list",
    "client": "f529fd55-7f4c-4e4d-92a0-275eae36a2c1"
}
http://localhost:8080/jolokia/notification/list/f529fd55-7f4c-4e4d-92a0-275eae36a2c1
  • Response
{
    "timestamp": 1364117962,
    "status": 200,
    "request": {
        "client": "f529fd55-7f4c-4e4d-92a0-275eae36a2c1",
        "command": "list",
        "type": "notification"
    },
    "value": {
        "1": {
            "mbean": "java.lang:type=Memory",
            "filter": [
                "java.management.memory.threshold.exceeded"
            ]
        }
    }
}