You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Paul Gale <pa...@gmail.com> on 2013/03/08 06:13:40 UTC

Have you written a custom lease database locker?

Hi,

Using: ActiveMQ 5.8.0 on RHEL 6.0

The documentation states that storage lockers are pluggable with regards to
persistence adapters. Taking it at its word I tried to combine the
lease-database-locker with the KahaDB persistence adapter. Fail. After
looking at the code for the lease-database-locker it's no wonder: it's
expecting a JDBCPersistenceAdapter as a parent.  Doh. Not that pluggable
after all.

So I have to come up with my own version of a lease-database-locker that
_will_ work with the KahaDBPersistenceAdapter. Why? Per the doc: NFSv4 is
required for failover to work reliably using KahaDB when using its default
storage locker. I'm restricted to using NFSv3 which is not going to work
with the default shared-file-locker. Therefore I need a hybrid approach:
Kaha for storage and a database for locking. Sounds easy enough, all I need
is a custom database lease locker. Or so I thought. However, after looking
it over it doesn't appear to be quite so straightforward given the somewhat
bazaar separation of responsibilities that exist given the actual
implementations of the respective persistence adapters and lockers. I've
made a few attempts at such a locker (the details of which I won't get into
here) but none of them worked.

Has anyone out there written a custom locker like this? If so, any guidance
would be much appreciated.

If no one has attempted this then I'll start getting into the specifics of
my attempts so far and others can chime in at that point.

Incidentally the XML schema indicates that the lease-database-locker tag is
a legitimate child tag for kahaDB. Why is that given that they cannot work
together out of the box?

Thanks,
Paul

Re: Have you written a custom lease database locker?

Posted by Gary Tully <ga...@gmail.com>.
Thanks for the feedback. there is room for improvement here for sure. Feel
free to open jira issues to capture your experiences and contribute updates.

The lease locker needs a jdbc connection and emerged from the jdbc store so
it needs a little more work to be fully separated. For one, the statements
should be externally configurable and the dependency on a persistence
adapter made optional. Ie: it should be possible to use it as broker lock
rather than a store lock.
I opened https://issues.apache.org/jira/browse/AMQ-4365 to track this.
The optional org.apache.activemq.broker.Locker#configure needs a variant
that will set the brokerService so that the ioexception handler and
identity are available. Maybe just being brokerServiceAware is sufficient.

btw: the xml schema is auto generated from the interfaces by xbean so it
shows up as an option, independent of the implementation dependencies.




On 8 March 2013 05:13, Paul Gale <pa...@gmail.com> wrote:

> Hi,
>
> Using: ActiveMQ 5.8.0 on RHEL 6.0
>
> The documentation states that storage lockers are pluggable with regards to
> persistence adapters. Taking it at its word I tried to combine the
> lease-database-locker with the KahaDB persistence adapter. Fail. After
> looking at the code for the lease-database-locker it's no wonder: it's
> expecting a JDBCPersistenceAdapter as a parent.  Doh. Not that pluggable
> after all.
>
> So I have to come up with my own version of a lease-database-locker that
> _will_ work with the KahaDBPersistenceAdapter. Why? Per the doc: NFSv4 is
> required for failover to work reliably using KahaDB when using its default
> storage locker. I'm restricted to using NFSv3 which is not going to work
> with the default shared-file-locker. Therefore I need a hybrid approach:
> Kaha for storage and a database for locking. Sounds easy enough, all I need
> is a custom database lease locker. Or so I thought. However, after looking
> it over it doesn't appear to be quite so straightforward given the somewhat
> bazaar separation of responsibilities that exist given the actual
> implementations of the respective persistence adapters and lockers. I've
> made a few attempts at such a locker (the details of which I won't get into
> here) but none of them worked.
>
> Has anyone out there written a custom locker like this? If so, any guidance
> would be much appreciated.
>
> If no one has attempted this then I'll start getting into the specifics of
> my attempts so far and others can chime in at that point.
>
> Incidentally the XML schema indicates that the lease-database-locker tag is
> a legitimate child tag for kahaDB. Why is that given that they cannot work
> together out of the box?
>
> Thanks,
> Paul
>



-- 
http://redhat.com
http://blog.garytully.com