[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: Client failover redeliveries discussion
clebert.suconic@jboss.com
do-not-reply at jboss.com
Fri Oct 20 20:44:02 EDT 2006
YEaaaaaaaaaahhhhhh Yeaaaaaaaaahhh... (I needed to share my joy somehow :-) )
I could just have ServerSide failover working along with ClientSide recovery (recovering client objects into the new server after connection failure event) on DurableSubscriptions. Of course there are still work to do but I was expecting to have it prototyped by the end of the next week, hence my joy.
Well, keeping the joy asside lets discuss what I have done so far, and what needs to be done:
I have created a method transferChannel into PagingChannelSupport that receives the oldChannel. This method will transfer all the state from the old node (ChainID representing the PostOffice) into the current chainID (or current queue).
Look at the code:
/** Transfer messages for an old channel to a new channel.
| * This is used during HA failoever when a connection fail and messages will need to be transfered to a new node */
| public void transferChannel(long oldchannelID) throws Exception
| {
| log.info("Transfering state from " + oldchannelID +" into " + this.getChannelID());
| synchronized (refLock)
| {
| while(true)
| {
| InitialLoadInfo ili =pm.getInitialReferenceInfos(oldchannelID,fullSize);
| if (ili.getRefInfos().size()==0)
| {
| break;
| }
|
| log.info("got " + ili.getRefInfos().size() + " references to move");
|
|
|
| Map refMap = pushReferences(ili);
| Iterator referencesIterator = ili.getRefInfos().iterator();
| while (referencesIterator.hasNext())
| {
| ReferenceInfo info = (ReferenceInfo)referencesIterator.next();
| log.info("transfering reference " + info.getMessageId() + " from " + oldchannelID + " into " + this.getChannelID());
| MessageReference messageReference = (MessageReference )refMap.get(new Long(info.getMessageId()));
|
| ///// BIG TODOS:
| ///// What to do with transaction here?
| ///// Do we need to remove from old channel? (Consider the case of the Old Server coming back... I guess we should.. bu we have to check this)
| pm.addReference(this.getChannelID(),messageReference,null);
| pm.removeReference(oldchannelID,messageReference, null);
| }
| }
| }
| log.info("transfer state done");
| }
|
|
For accomplishing this I have also added a new parameter into SessionEndpoint.createConsumerDelegate (.... ,oldChainID) where I send the oldChainID when we are recreating objects.
For the method itself I have to verify how to encapsulate a transaction in a better fashion, and these todos I have on the method. And of course better test it, I will get probably some bugs out of this... but this is a very good start.
Clebert
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979765#3979765
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979765
More information about the jboss-dev-forums
mailing list