Version 16

    JBoss Messaging 2.0 Management

     

    JIRA task: http://jira.jboss.org/jira/browse/JBMESSAGING-1303

     

    Requirements

     

    • Manage JBoss Messaging 2.0 when run in standalone mode, embedded mode or in JBoss AS (using JBoss microcontainer)

    • Separate management interfaces for Core and JMS functionalities

    • Compatible with JON (JBoss Operation Network)

    • Compatible with standard JMX console (e.g. jconsole)

    • Provide a management API:

      • suitable for a GUI-based JMX console (hierarchical JMX ObjectNames, OpenTypes)

      • programmatic interface (native type, hierarchical navigation of managed resources)

      • notifications for events (queue creation/deletion, memory/message count treshold,...)

     

    Managed Resources

     

    Core Module

     

    In order to provide an user-friendly way to manage the resources, the ObjectNames of the resources will be designed so that they formed a tree in a GUI console like jconsole

     

    org.jboss.messaging:
      |
      + Core 
      |  + Address
      |  |  + Foo
      |  |  + Bar
      |  |
      |  + Queue
      |  |  + Foo
      |  |  |  + Queue1
      |  |  |  + Queue2
      |  |  + Bar
      |  |     + Queue3
      |  + Server
      |      
      - JMS 
      ...  
    

     

    For example, from the tree hierarchy, we can see that the queue "Queue2" is bound to the Address "Foo" while "Queue3" is bound to the address "Bar".

     

    MessagingServer

     

    • registered when the Messaging Server is started

    • unregistered when the Messaging Server is stopped

     

    ObjectName:    org.jboss.messaging:module=Core,type=Server
    --------------
    Attributes:    Version [R]
                   Started [R]
                   ConnectionCount [R]
                   // All attributes found in Configuration (read-only)
    --------------
    Operations:    addAddress(address)
                   removeAddress(address)
                   
                   create(address, queueName)
                   createQueue(address, queueName, filter, durable, temporary)
                   destroyQueue(name)
    --------------
    Notifications: 
                   QUEUE_CREATED
                   QUEUE_DESTROYED
                   ADDRESS_ADDED
                   ADDRESS_REMOVED
    

     

    • A queue must not be unbound. It is created through the createQueue() operations

    • createQueue() has 2 set of parameters, the simplest one using default queue settings (null filter, durable and not temporary)

    • destroyQueue() also unbinds the queue

    • addAddress() throws an exception if the address already exists

    • removeAddress() throws an exception if there are queues bound to the address

    • createQueue() throws an exception if a queue with the given name already exists

    • destroyQueue() throws an exception if there no queue with the given name

     

    RemotingService

     

    • registered when the RemotingService is started

    • unregistered when the RemotingService is stopped

     

    ObjectName:    org.jboss.messaging:module=Core,type=RemotingService
    --------------
    Attributes:    Location [R]
                   Acceptors [R]
    --------------
    Operations:
    Notifications:
    

     

    Address

     

    • registered when the first Binding is created with this address

    • unregistered when the last Binding is removed from this address

     

    ObjectName:    org.jboss.messaging:module=Core,type=Address,name=<address>
    --------------
    Attributes:    Address [R]
                   QueuesNames [R]
                   Roles:TabularData<RoleInfo> [R]
                   RoleInfos [R]
    --------------
    Operations:   
                   addRole(name, create, read, write)
                   removeRole(role)
    --------------
    Notifications:
    

     

    • addRole() throws an exception if there is already a role with the given name

    • removeRole() throws an exception if there is no role with the given name

     

    Queue

     

    • registered when this queue is bound to the address

    • unregistered when this queue is unbound from the address

     

    ObjectName:    org.jboss.messaging:module=Core,type=Queue,address=<address>,name=<queue name>
    --------------
    Attributes:    Name [R]
                   PersistenceID [R]
                   Clustered [R]
                   Temporary [R]
                   Durable [R]
                   Filter [R]
                   SizeBytes [R]
                   MaxSizeBytes [R]
                   MessageCount [R]
                   ScheduledCount [R]
                   ConsumerCount [R]
                   DeliveringCount [R]
                   MessagesAdded [R]               
    --------------
    Operations:    listAllMessages():TabularData<MessageInfo>
                   listMessages(filter:String):TabularData<MessageInfo>
                   removeAllMessages()
                   removeMessage(messageID)
                   sendToDLQ(messageID)
                   expire(messageID)
                   changePriority(messageID)
    --------------
    Notifications:
    

     

    MessageInfo

     

    This data structure represents the information for a given Core message

     

    CompositeType

    id

    String

    destination

     String

    durable

    boolean

    timestamp

    long

    type

    String

    size

    int

    priority

    int

    expiration

    long

     expired

    boolean

    properties

    TabularType<key,value>

     

    RoleInfo

     

    This data structure represents the information for a given role

     

    CompositeType

    name

    String

    create

    boolean

    read

    boolean

    write

    boolean

     

    JMS Module

     

    All JMS managements must be done through the JMS management resources.

    It is not expected for the user to have to use the Core management resources

     

    JMS Server

     

    • registered when the JMS server is started

    • unregistered when the JMS server is stopped

     

    ObjectName:    org.jboss.messaging:module=JMS,type=Server
    --------------
    Attributes:    Version [R]
                   Started [R]
                   TemporaryQueues:String[] [R]
                   TemporaryTopics:String[] [R]
    --------------
    Operations:    createQueue(queueName, jndiBinding)
                   destroyQueue(queueName)
                   
                   createTopic(topicName, jndiBinding)
                   destroyTopic(topicName)
                   
                   createConnectionFactory(name, ...)
                   destroyConnectionFactory(name)               
    --------------
    Notifications: JMS_QUEUE_CREATED
                   JMS_QUEUE_DESTROYED
                   JMS_TOPIC_CREATED
                   JMS_TOPIC_DESTROYED
                   JMS_CONNECTION_FACTORY_CREATED
                   JMS_CONNECTION_FACTORY_DESTROYED
    

     

    • createQueue() throws an exception if there is already a queue with the given name

    • idem for createTopic()

    • destroyQueue() throws an exception if there is no queue with the given name

    • idem for destroyTopic()

     

    JMS Queue

     

    JMS Queues and Topics will expose the same set of operations than the Core Queues.

     

    • registered when the JMS Queue is created

    • unregistered when the JMS Queue is destroyed

     

    ObjectName:    org.jboss.messaging:module=JMS,type=Queue,name=<queue name>
    --------------
    Attributes:    Name [R]
                   Temporary [R]
                   MessageCount [R]
    --------------
    Operations:    removeAllMessages()
                   ...
    --------------
    Notifications:
    

     

    Topic

     

    • registered when the Topic is created

    • unregistered when the Topic is destroyed

     

    ObjectName:    org.jboss.messaging:module=JMS,type=Topic,name=<topic name>
    --------------
    Attributes:    Name [R]
                   Temporary [R]
                   SubscriptionsCount [R]
                   DurableSubscriptionsCount [R]
                   NonDurableSubscriptionsCount [R]
                   MessageCount [R]
                   DurableMessageCount [R]
                   NonDurableMessageCount [R]
    --------------
    Operations:    removeAllMessages()
    
                   listAllSubscribers():TabularData<SubscriberInfo>
                   listNonDurableSubscribers():TabularData<SubscriberInfo>
                   listDurableSubscribers():TabularData<SubscriberInfo>
    
                   listAllSubscriberInfos():SubscriberInfo[]
                   listNonDurableSubscriberInfos():SubscriberInfo[]
                   listDurableSubscriberInfos():SubscriberInfo[]
                   
                   ...
    --------------
    Notifications:
    

     

    SubscriberInfo

     

    This open type structure represents the information for a given topic's subscriber

     

    CompositeType

    id

    String

    name

    String

    clientID

    String

    durable

    boolean

    selector

    String

    messageCount

    int

    maxSizeBytes

    int

     

    ConnectionFactory

     

    ObjectName:    org.jboss.messaging:module=JMS,type=ConnectionFactory,name=<connection factory name>
    --------------
    Attributes:    Name [R]
                   JNDIBindings [R]
                   ClientID [R]
                   DupsOKBatchSize [R]
                   ConsumerWindowSize [R]
                   ConsumerMaxRate [R]
                   ProducerWindowSize [R]
                   ProducerMaxRate [R]
                   BlockOnAcknowledge [R]
                   DefaultSendNonPersistentMessagesBlocking [R]
                   DefaultSendPersistentMessagesBlocking [R]
    --------------
    Operations:    listConnections():<ConnectionInfo>
                   listConnections(user):TabularData<ConnectionInfo>
    
                   listConnections():ConnectionInfo[]
                   listConnections(user):ConnectionInfo[]
    --------------
    Notifications:
    

     

    ConnectionInfo

     

    This open type structure represents the information for a given connection

     

    CompositeType

    clientID

    String

    dupsOKBatchSize

    int

     

    Implementation

     

    The managed resources will be managed through regular MBeans. Their implementation delegates to specific JBM objects surrounded by management specific code (mainly type conversion & user input validation)

     

    Example for the Core Queue:

     

           +-----------------------+    +---------------+
           |   QueueControlMBean   |    | StandardMBean |
           |         <<Interface>> |    |               |
           |-----------------------|    +---------------+
           | isClustered():boolean |           ^
           | ...                   |           |
           +-----------------------+           |
                      ^                        |
                      |________________________|
                                 |
                   +-----------------------------+
                   | QueueControl                |
                   |-----------------------------|
                   | - managedQueue: Queue       |
                   |-----------------------------|
                   | # QueueControl(queue:Queue) |    +------------------------------------+ 
                   | ...                         |<---| boolean isClustered()              | \
                   | ...                         |    | {                                  +-+
                   +-----------------------------+    |   return managedQueue.isClustered(); |
                                                      | }                                    |
                                                      +--------------------------------------+
    
    

     

    QueueControl is mainly a wrapper around JBoss Messaging Queue.

    It exposes only the methods required for management and adds code to validate user input (setter methods + operations)

    and converts types (e.g. String<->SimpleString)

     

    With this design, all the boilerplate management code can be fairly separated from the main code.

    However, code to register/unregistered the MBean in the platform MBean server is still called from the main code.

     

    Naming Conventions

     

    For every XXX resources we want to manage (e.g. Queue, JMS Topic), we must create the following 2 types:

    {font:courier new

    XXXControlMBean} the MBean interface used by the client to manage the XXX resource

    {font:courier new

    XXXControl} the implementation of the MBean. Mainly a wrapper around the XXX type + type conversion, user input validation and exception handling

     

    User Input validation and exception handling

    • all setter methods must validate user input (e.g. for int range)

      • in case of failure, a IllegalArgumentException must be thrown

    • if a operation does not succeed, it must fail with an exception thrown to the client (e.g. IllegalStateException)

    • as a convenience, all MBean operations should be annotated to help JMX console provide operation description and meaningful parameter names