You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Frizz <fr...@googlemail.com> on 2013/09/25 12:26:43 UTC

Configuration of custom plugins with XBeans

Hello,

I create my own BrokerPlugin and configured it in activemq.xml like this:

<broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" dataDirectory="${activemq.data}">
    <plugins>
        <bean xmlns="http://www.springframework.org/schema/beans"
id="myBrokerPlugin" class="myPackage.MyBrokerPlugin">
    </plugins>
...


That works :-)


Now I want to make it more configurable. The idea is to use DestinationMaps
like in existing standard plugins (e.g. in AuthorizationPlugin).

I created two new classes, QueueFilterMap and QueueFilterEntry, that use
XBeans.

So my activemq.xml would look like this:

<plugins>
    <bean xmlns="http://www.springframework.org/schema/beans"
id="myBrokerPlugin" class="myPackage.MyBrokerPlugin">
        <map>
            <queueFilterMap>
                <queueFilterEntries>
                    <queueFilterEntry queue="USERS.>"/>
                </queueFilterEntries>
            </queueFilterMap>
        </map>
    <bean/>
</plugins>

Of course this does not validate. So my question is: How can I use XBeans
in activemq.xml?

cheers,
F.

Re: Configuration of custom plugins with XBeans

Posted by Christian Posta <ch...@gmail.com>.
yah probably because you're declaring the <bean> to be in the spring
schema, so everything else within the bean def will expect to be w/in
spring schema. would probably need to augment the auto generated activemq
schema to support your new schema....


On Wed, Sep 25, 2013 at 2:54 PM, Frizz <fr...@googlemail.com> wrote:

> Hello Christian,
>
> that was an interesting read. Thank you.
>
> I tried to "incorporate" your simpleController example into my
> activemq.xml.
>
> It works fine outside of the <plugins> definition, but when I do something
> like this I get an IllegalArgumentException: Cannot locate
> BeanDefinitionDecorator for element [simple].
>
> <plugins>
>     <bean xmlns="http://www.springframework.org/schema/beans"
>         id="myBrokerPlugin" class="myPackage.MyBrokerPlugin">
>
>         <simple xmlns="http://christianposta.com/schema/core"
> myProperty="testMe">
>             <simpleController>
>                 <simpleController controllerName="testMeToo" />
>             </simpleController>
>
>             <controllers>
>                 <complexController pattern="testPattern" />
>                 <complexController pattern="testPattern2" />
>                 <complexController pattern="testPattern3" />
>             </controllers>
>         </simple>
>
>     <bean/>
> </plugins>
>
>
> How can I use this custom bean to configure my BrokerPlugin?
>
> cheers,
> F.
>
>
>
>
>
> On Wed, Sep 25, 2013 at 2:32 PM, Christian Posta
> <ch...@gmail.com>wrote:
>
> > not sure if this will help, but i did write a blog about how ActiveMQ
> uses
> > xbeans to generate its XSD:
> >
> > http://www.christianposta.com/blog/?p=111
> >
> >
> > On Wed, Sep 25, 2013 at 3:26 AM, Frizz <fr...@googlemail.com>
> wrote:
> >
> > > Hello,
> > >
> > > I create my own BrokerPlugin and configured it in activemq.xml like
> this:
> > >
> > > <broker xmlns="http://activemq.apache.org/schema/core"
> > > brokerName="localhost" dataDirectory="${activemq.data}">
> > >     <plugins>
> > >         <bean xmlns="http://www.springframework.org/schema/beans"
> > > id="myBrokerPlugin" class="myPackage.MyBrokerPlugin">
> > >     </plugins>
> > > ...
> > >
> > >
> > > That works :-)
> > >
> > >
> > > Now I want to make it more configurable. The idea is to use
> > DestinationMaps
> > > like in existing standard plugins (e.g. in AuthorizationPlugin).
> > >
> > > I created two new classes, QueueFilterMap and QueueFilterEntry, that
> use
> > > XBeans.
> > >
> > > So my activemq.xml would look like this:
> > >
> > > <plugins>
> > >     <bean xmlns="http://www.springframework.org/schema/beans"
> > > id="myBrokerPlugin" class="myPackage.MyBrokerPlugin">
> > >         <map>
> > >             <queueFilterMap>
> > >                 <queueFilterEntries>
> > >                     <queueFilterEntry queue="USERS.>"/>
> > >                 </queueFilterEntries>
> > >             </queueFilterMap>
> > >         </map>
> > >     <bean/>
> > > </plugins>
> > >
> > > Of course this does not validate. So my question is: How can I use
> XBeans
> > > in activemq.xml?
> > >
> > > cheers,
> > > F.
> > >
> >
> >
> >
> > --
> > *Christian Posta*
> > http://www.christianposta.com/blog
> > twitter: @christianposta
> >
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: Configuration of custom plugins with XBeans

Posted by Frizz <fr...@googlemail.com>.
Hello Christian,

that was an interesting read. Thank you.

I tried to "incorporate" your simpleController example into my activemq.xml.

It works fine outside of the <plugins> definition, but when I do something
like this I get an IllegalArgumentException: Cannot locate
BeanDefinitionDecorator for element [simple].

<plugins>
    <bean xmlns="http://www.springframework.org/schema/beans"
        id="myBrokerPlugin" class="myPackage.MyBrokerPlugin">

        <simple xmlns="http://christianposta.com/schema/core"
myProperty="testMe">
            <simpleController>
                <simpleController controllerName="testMeToo" />
            </simpleController>

            <controllers>
                <complexController pattern="testPattern" />
                <complexController pattern="testPattern2" />
                <complexController pattern="testPattern3" />
            </controllers>
        </simple>

    <bean/>
</plugins>


How can I use this custom bean to configure my BrokerPlugin?

cheers,
F.





On Wed, Sep 25, 2013 at 2:32 PM, Christian Posta
<ch...@gmail.com>wrote:

> not sure if this will help, but i did write a blog about how ActiveMQ uses
> xbeans to generate its XSD:
>
> http://www.christianposta.com/blog/?p=111
>
>
> On Wed, Sep 25, 2013 at 3:26 AM, Frizz <fr...@googlemail.com> wrote:
>
> > Hello,
> >
> > I create my own BrokerPlugin and configured it in activemq.xml like this:
> >
> > <broker xmlns="http://activemq.apache.org/schema/core"
> > brokerName="localhost" dataDirectory="${activemq.data}">
> >     <plugins>
> >         <bean xmlns="http://www.springframework.org/schema/beans"
> > id="myBrokerPlugin" class="myPackage.MyBrokerPlugin">
> >     </plugins>
> > ...
> >
> >
> > That works :-)
> >
> >
> > Now I want to make it more configurable. The idea is to use
> DestinationMaps
> > like in existing standard plugins (e.g. in AuthorizationPlugin).
> >
> > I created two new classes, QueueFilterMap and QueueFilterEntry, that use
> > XBeans.
> >
> > So my activemq.xml would look like this:
> >
> > <plugins>
> >     <bean xmlns="http://www.springframework.org/schema/beans"
> > id="myBrokerPlugin" class="myPackage.MyBrokerPlugin">
> >         <map>
> >             <queueFilterMap>
> >                 <queueFilterEntries>
> >                     <queueFilterEntry queue="USERS.>"/>
> >                 </queueFilterEntries>
> >             </queueFilterMap>
> >         </map>
> >     <bean/>
> > </plugins>
> >
> > Of course this does not validate. So my question is: How can I use XBeans
> > in activemq.xml?
> >
> > cheers,
> > F.
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>

Re: Configuration of custom plugins with XBeans

Posted by Christian Posta <ch...@gmail.com>.
not sure if this will help, but i did write a blog about how ActiveMQ uses
xbeans to generate its XSD:

http://www.christianposta.com/blog/?p=111


On Wed, Sep 25, 2013 at 3:26 AM, Frizz <fr...@googlemail.com> wrote:

> Hello,
>
> I create my own BrokerPlugin and configured it in activemq.xml like this:
>
> <broker xmlns="http://activemq.apache.org/schema/core"
> brokerName="localhost" dataDirectory="${activemq.data}">
>     <plugins>
>         <bean xmlns="http://www.springframework.org/schema/beans"
> id="myBrokerPlugin" class="myPackage.MyBrokerPlugin">
>     </plugins>
> ...
>
>
> That works :-)
>
>
> Now I want to make it more configurable. The idea is to use DestinationMaps
> like in existing standard plugins (e.g. in AuthorizationPlugin).
>
> I created two new classes, QueueFilterMap and QueueFilterEntry, that use
> XBeans.
>
> So my activemq.xml would look like this:
>
> <plugins>
>     <bean xmlns="http://www.springframework.org/schema/beans"
> id="myBrokerPlugin" class="myPackage.MyBrokerPlugin">
>         <map>
>             <queueFilterMap>
>                 <queueFilterEntries>
>                     <queueFilterEntry queue="USERS.>"/>
>                 </queueFilterEntries>
>             </queueFilterMap>
>         </map>
>     <bean/>
> </plugins>
>
> Of course this does not validate. So my question is: How can I use XBeans
> in activemq.xml?
>
> cheers,
> F.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta