Spring AMQP

org.springframework.amqp.rabbit.admin
Class RabbitBrokerAdmin

java.lang.Object
  extended by org.springframework.amqp.rabbit.admin.RabbitBrokerAdmin
All Implemented Interfaces:
AmqpAdmin, RabbitBrokerOperations

public class RabbitBrokerAdmin
extends Object
implements RabbitBrokerOperations

Rabbit broker administration implementation exposed via JMX annotations.

Author:
Mark Pollack

Field Summary
protected  org.apache.commons.logging.Log logger
          Logger available to subclasses
 
Constructor Summary
RabbitBrokerAdmin(ConnectionFactory connectionFactory)
           
 
Method Summary
 void addUser(String username, String password)
           
 int addVhost(String vhostPath)
           
 void changeUserPassword(String username, String newPassword)
           
 void clearPermissions(String username)
           
 void clearPermissions(String username, String vhostPath)
           
protected  void createErlangTemplate(ConnectionFactory otpCf)
           
 void declareBinding(Binding binding)
          Declare a binding of a queue to an exchange.
 void declareExchange(Exchange exchange)
          Declare an exchange
 void declareExchange(String exchangeName, String exchangeType, boolean durable, boolean autoDelete)
          Declare an exchange specifying its durability and auto-delete behavior.
 Queue declareQueue()
          Declare a queue whose name is automatically named.
 void declareQueue(Queue queue)
          Declare the given queue
 void deleteExchange(String exchangeName)
          Delete an exchange.
 com.rabbitmq.client.AMQP.Exchange.DeleteOk deleteExchange(String exchangeName, boolean ifUnused)
           
 void deleteQueue(String queueName)
          Delete a queue, without regard for whether it is in use or has messages on it
 void deleteQueue(String queueName, boolean unused, boolean empty)
          Delete a queue
 void deleteUser(String username)
           
 int deleteVhost(String vhostPath)
           
 void forceResetNode()
          The forceResetNode command differs from RabbitBrokerOperations.resetNode() in that it resets the node unconditionally, regardless of the current management database state and cluster configuration.
 ErlangTemplate getErlangTemplate()
           
 List<QueueInfo> getQueues()
           
 RabbitStatus getStatus()
          Returns the status of the node.
protected  void initializeDefaultErlangTemplate(RabbitTemplate rabbitTemplate)
           
 List<String> listPermissions()
           
 List<String> listPermissions(String vhostPath)
           
 List<String> listUserPermissions(String username)
           
 List<String> listUsers()
           
 void purgeQueue(String queueName, boolean noWait)
          Purges the contents of the given queue.
 void recoverAsync(boolean requeue)
           
 void removeBinding(Binding binding)
           
 void resetNode()
          Removes the node from any cluster it belongs to, removes all data from the management database, such as configured users and vhosts, and deletes all persistent messages.
 void setPermissions(String username, Pattern configure, Pattern read, Pattern write)
           
 void setPermissions(String username, Pattern configure, Pattern read, Pattern write, String vhostPath)
           
 void startBrokerApplication()
          Starts the RabbitMQ application on an already running node.
 void startNode()
          Starts the Erlang node where RabbitMQ is running by shelling out to the directory specified by RABBITMQ_HOME and executing the standard named start script.
 void stopBrokerApplication()
          Stops the RabbitMQ application, leaving the Erlang node running.
 void stopNode()
          Stops the halts the Erlang node on which RabbitMQ is running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Logger available to subclasses

Constructor Detail

RabbitBrokerAdmin

public RabbitBrokerAdmin(ConnectionFactory connectionFactory)
Method Detail

declareExchange

public void declareExchange(Exchange exchange)
Description copied from interface: AmqpAdmin
Declare an exchange

Specified by:
declareExchange in interface AmqpAdmin
Parameters:
exchange - the exchange to declare.

declareExchange

@ManagedOperation
public void declareExchange(String exchangeName,
                                             String exchangeType,
                                             boolean durable,
                                             boolean autoDelete)
Declare an exchange specifying its durability and auto-delete behavior. Explicit arguments are given so as to make this method easily accessible from JMX management consoles. Durable exchanges last until they are deleted, they will survive a server restart. Auto-deleted exchanges last until they are no longer used

Parameters:
exchangeName - the name of the exchange
exchangeType - the exchange type
durable - true if we are declaring a durable exchange (the exchange will survive a server restart)
autoDelete - true if the server should delete the exchange when it is no longer in use

deleteExchange

@ManagedOperation(description="Delete a exchange, without regard for whether it is in use or has messages on it")
@ManagedOperationParameters(value=)
public void deleteExchange(String exchangeName)
Description copied from interface: AmqpAdmin
Delete an exchange. Look at implementation specific subclass for implementation specific behavior, for example for RabbitMQ this will delete the exchange without regard for whether it is in use or not.

Specified by:
deleteExchange in interface AmqpAdmin
Parameters:
exchangeName - the name of the exchange

deleteExchange

@ManagedOperation
public com.rabbitmq.client.AMQP.Exchange.DeleteOk deleteExchange(String exchangeName,
                                                                                  boolean ifUnused)
Specified by:
deleteExchange in interface RabbitBrokerOperations

declareQueue

@ManagedOperation
public Queue declareQueue()
Description copied from interface: AmqpAdmin
Declare a queue whose name is automatically named. It is created with exclusive = true, autoDelete=true, and durable = false.

Specified by:
declareQueue in interface AmqpAdmin

declareQueue

@ManagedOperation
public void declareQueue(Queue queue)
Description copied from interface: AmqpAdmin
Declare the given queue

Specified by:
declareQueue in interface AmqpAdmin
Parameters:
queue - the queue to declare

deleteQueue

@ManagedOperation
public void deleteQueue(String queueName)
Description copied from interface: AmqpAdmin
Delete a queue, without regard for whether it is in use or has messages on it

Specified by:
deleteQueue in interface AmqpAdmin
Parameters:
queueName - the name of the queue

deleteQueue

@ManagedOperation
public void deleteQueue(String queueName,
                                         boolean unused,
                                         boolean empty)
Description copied from interface: AmqpAdmin
Delete a queue

Specified by:
deleteQueue in interface AmqpAdmin
Parameters:
queueName - the name of the queue
unused - true if the queue should be deleted only if not in use
empty - true if the queue should be deleted only if empty

purgeQueue

@ManagedOperation
public void purgeQueue(String queueName,
                                        boolean noWait)
Description copied from interface: AmqpAdmin
Purges the contents of the given queue.

Specified by:
purgeQueue in interface AmqpAdmin
Parameters:
queueName - the name of the queue
noWait - true to not await completion of the purge

getQueues

public List<QueueInfo> getQueues()
Specified by:
getQueues in interface RabbitBrokerOperations

declareBinding

public void declareBinding(Binding binding)
Description copied from interface: AmqpAdmin
Declare a binding of a queue to an exchange.

Specified by:
declareBinding in interface AmqpAdmin
Parameters:
binding - a description of the binding to declare.

removeBinding

public void removeBinding(Binding binding)
Specified by:
removeBinding in interface RabbitBrokerOperations

addUser

@ManagedOperation
public void addUser(String username,
                                     String password)
Specified by:
addUser in interface RabbitBrokerOperations

deleteUser

@ManagedOperation
public void deleteUser(String username)
Specified by:
deleteUser in interface RabbitBrokerOperations

changeUserPassword

@ManagedOperation
public void changeUserPassword(String username,
                                                String newPassword)
Specified by:
changeUserPassword in interface RabbitBrokerOperations

listUsers

@ManagedOperation
public List<String> listUsers()
Specified by:
listUsers in interface RabbitBrokerOperations

addVhost

public int addVhost(String vhostPath)
Specified by:
addVhost in interface RabbitBrokerOperations

deleteVhost

public int deleteVhost(String vhostPath)
Specified by:
deleteVhost in interface RabbitBrokerOperations

setPermissions

public void setPermissions(String username,
                           Pattern configure,
                           Pattern read,
                           Pattern write)
Specified by:
setPermissions in interface RabbitBrokerOperations

setPermissions

public void setPermissions(String username,
                           Pattern configure,
                           Pattern read,
                           Pattern write,
                           String vhostPath)
Specified by:
setPermissions in interface RabbitBrokerOperations

clearPermissions

public void clearPermissions(String username)
Specified by:
clearPermissions in interface RabbitBrokerOperations

clearPermissions

public void clearPermissions(String username,
                             String vhostPath)
Specified by:
clearPermissions in interface RabbitBrokerOperations

listPermissions

public List<String> listPermissions()
Specified by:
listPermissions in interface RabbitBrokerOperations

listPermissions

public List<String> listPermissions(String vhostPath)
Specified by:
listPermissions in interface RabbitBrokerOperations

listUserPermissions

public List<String> listUserPermissions(String username)
Specified by:
listUserPermissions in interface RabbitBrokerOperations

startBrokerApplication

@ManagedOperation
public void startBrokerApplication()
Description copied from interface: RabbitBrokerOperations
Starts the RabbitMQ application on an already running node. This command is typically run after performing other management actions that required the RabbitMQ application to be stopped, e.g. reset.

Specified by:
startBrokerApplication in interface RabbitBrokerOperations

stopBrokerApplication

@ManagedOperation
public void stopBrokerApplication()
Description copied from interface: RabbitBrokerOperations
Stops the RabbitMQ application, leaving the Erlang node running.

Specified by:
stopBrokerApplication in interface RabbitBrokerOperations

startNode

@ManagedOperation
public void startNode()
Description copied from interface: RabbitBrokerOperations
Starts the Erlang node where RabbitMQ is running by shelling out to the directory specified by RABBITMQ_HOME and executing the standard named start script. It spawns the shell command execution into its own thread.

Specified by:
startNode in interface RabbitBrokerOperations

stopNode

@ManagedOperation
public void stopNode()
Description copied from interface: RabbitBrokerOperations
Stops the halts the Erlang node on which RabbitMQ is running. To restart the node you will need to execute the start script from a command line or via other means.

Specified by:
stopNode in interface RabbitBrokerOperations

resetNode

@ManagedOperation
public void resetNode()
Description copied from interface: RabbitBrokerOperations
Removes the node from any cluster it belongs to, removes all data from the management database, such as configured users and vhosts, and deletes all persistent messages.

For RabbitBrokerOperations.resetNode() and RabbitBrokerOperations.forceResetNode() to succeed the RabbitMQ application must have been stopped, e.g. RabbitBrokerOperations.stopBrokerApplication()

Specified by:
resetNode in interface RabbitBrokerOperations

forceResetNode

@ManagedOperation
public void forceResetNode()
Description copied from interface: RabbitBrokerOperations
The forceResetNode command differs from RabbitBrokerOperations.resetNode() in that it resets the node unconditionally, regardless of the current management database state and cluster configuration. It should only be used as a last resort if the database or cluster configuration has been corrupted.

For RabbitBrokerOperations.resetNode() and RabbitBrokerOperations.forceResetNode() to succeed the RabbitMQ application must have been stopped, e.g. RabbitBrokerOperations.stopBrokerApplication()

Specified by:
forceResetNode in interface RabbitBrokerOperations

getStatus

@ManagedOperation
public RabbitStatus getStatus()
Description copied from interface: RabbitBrokerOperations
Returns the status of the node.

Specified by:
getStatus in interface RabbitBrokerOperations
Returns:
status of the node.

recoverAsync

public void recoverAsync(boolean requeue)
Specified by:
recoverAsync in interface RabbitBrokerOperations

getErlangTemplate

public ErlangTemplate getErlangTemplate()

initializeDefaultErlangTemplate

protected void initializeDefaultErlangTemplate(RabbitTemplate rabbitTemplate)

createErlangTemplate

protected void createErlangTemplate(ConnectionFactory otpCf)

Spring AMQP

Copyright © 2010. All Rights Reserved.