BTW I've moved this over to the dev list.

You could have a single durable subscription that was used by a new
'PersistentLastImageRecoveryPolicy' implementation. Then each message
received by the policy is used to update the cache - but you only
acknowledge the previous message.

e.g.

Receive M1, update the cache.
Receive M2, update the cache then acknowledge M1.
*broker dies*
Restart durable subscriber for policy
Receive M2, update the cache
Receive M3, update the cache and acknowledge M2
...

Another option could be to try just write a LastImageRecoveryPolicy
store where you maybe use Kaha to keep a persistent image of the cache
on disk. The former is maybe the simplest to write, the latter is
probably more efficient but would require you to delve into the Kaha
codebase


On 7/24/06, himmeric <[EMAIL PROTECTED]> wrote:

I discussed this a while back on IRC with Hiram and a few others.

Basically I need to have Subscription Recovery Policies work between broker
restarts for non durable subscribers and NON_PERSISTENT messages on topics.
So the use case would looks something like this:

topic://FOO.X is configured with LastImageRecoveryPolicy

Msg 1 published on topic://FOO.X
Consumer A joins and receives Msg 1 (since he is consumer.retroactive=true)
Broker stops and restarts
Consumer B joins before additional messages published to topic://FOO.X
Consumer B receives Msg 1 on topic://FOO.X

I'm not sure the best way to achieve this.  I played with having a durable
root consumer that would only acknowlege() messages if they weren't found in
the recovery policy.  Then the recovery process would be for this durable
consumer to replay messages to the recovery policy on a restart.  Obviously
this is quite a hack and I didn't get it working because I don't think I
actually had the Topic's real RecoveryPolicy object (appears the
PolicyEntry.getSubscriptionRecoveryPolicy() returned a copy).

I think we need to make sure if a message is referenced by a recovery policy
it needs to be persisted even if it's not persistent.  And then second
replay these messages somehow on restart.

I'd actually be happy if I could get this working with just the
LastImageRecoveryPolicy as it's the only one I'm using at this point.  But a
more generic solution would be good too.

Thoughts?
--
View this message in context: 
http://www.nabble.com/Recovery-Policies-should-apply-between-broker-restart-tf1994690.html#a5474786
Sent from the ActiveMQ - User forum at Nabble.com.




--

James
-------
http://radio.weblogs.com/0112098/

Reply via email to