You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Anthrope <pn...@anthrope.com> on 2007/08/09 19:58:18 UTC

Persistence Adaptor MBean

Hello,
    I have a custom persistence adaptor that uses Berkeley DB, and would
like to expose the message store as an MBean, since I am collecting stats
like average message size, etc. and would rather have those queried via JMX
than to log them to log4j. Any idea how I could expose either the
persistence adaptor or message store objects as MBeans?

Thanks,
Prashanth
-- 
View this message in context: http://www.nabble.com/Persistence-Adaptor-MBean-tf4244154s2354.html#a12077446
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Persistence Adaptor MBean

Posted by Anthrope <pn...@anthrope.com>.
Mario,
     This looks very promising; it's exactly what I need. Thanks for the
information; I shall code these features today and follow up.


Best regards,
Prashanth


Mario Siegenthaler-2 wrote:
> 
> The default JDBCPersistenceAdapter has access to the BrokerService.
> The broker service exposes the ManagementContext that contains a
> getMBeanServer-method. So you get easy access to the MBean-Server.
> Just register your JMX-Bean there. Example:
> 
>         // just to illustrate..
>         MyPersistenceAdapter adapter = this;
>         MyPersietenceAdapterMBean view = this; // or make a new MPAView()
> 
>         MBeanServer mbeanServer =
> brokerService.getManagementContext().getMBeanServer();
>         if (mbeanServer != null) {
>                 ObjectName objectName = new
> ObjectName(managementContext.getJmxDomainName() + ":" + "BrokerName="
>                         +
> JMXSupport.encodeObjectNamePart(getBrokerName()) + "," +
> "Type=ProxyConnector," + "ProxyConnectorName="
>                         +
> JMXSupport.encodeObjectNamePart(connector.getName()));
>                 mbeanServer.registerMBean(view, objectName);
>          }
> 
> 
> Mario
> 
> On 8/9/07, Anthrope <pn...@anthrope.com> wrote:
>>
>> Hello,
>>     I have a custom persistence adaptor that uses Berkeley DB, and would
>> like to expose the message store as an MBean, since I am collecting stats
>> like average message size, etc. and would rather have those queried via
>> JMX
>> than to log them to log4j. Any idea how I could expose either the
>> persistence adaptor or message store objects as MBeans?
>>
>> Thanks,
>> Prashanth
>> --
>> View this message in context:
>> http://www.nabble.com/Persistence-Adaptor-MBean-tf4244154s2354.html#a12077446
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Persistence-Adaptor-MBean-tf4244154s2354.html#a12090510
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Persistence Adaptor MBean

Posted by Mario Siegenthaler <ms...@inventsoft.ch>.
The default JDBCPersistenceAdapter has access to the BrokerService.
The broker service exposes the ManagementContext that contains a
getMBeanServer-method. So you get easy access to the MBean-Server.
Just register your JMX-Bean there. Example:

        // just to illustrate..
        MyPersistenceAdapter adapter = this;
        MyPersietenceAdapterMBean view = this; // or make a new MPAView()

        MBeanServer mbeanServer =
brokerService.getManagementContext().getMBeanServer();
        if (mbeanServer != null) {
                ObjectName objectName = new
ObjectName(managementContext.getJmxDomainName() + ":" + "BrokerName="
                        +
JMXSupport.encodeObjectNamePart(getBrokerName()) + "," +
"Type=ProxyConnector," + "ProxyConnectorName="
                        + JMXSupport.encodeObjectNamePart(connector.getName()));
                mbeanServer.registerMBean(view, objectName);
         }


Mario

On 8/9/07, Anthrope <pn...@anthrope.com> wrote:
>
> Hello,
>     I have a custom persistence adaptor that uses Berkeley DB, and would
> like to expose the message store as an MBean, since I am collecting stats
> like average message size, etc. and would rather have those queried via JMX
> than to log them to log4j. Any idea how I could expose either the
> persistence adaptor or message store objects as MBeans?
>
> Thanks,
> Prashanth
> --
> View this message in context: http://www.nabble.com/Persistence-Adaptor-MBean-tf4244154s2354.html#a12077446
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>