Re: Message-id management revisited

From: Mark Taylor <m.b.taylor-at-bristol.ac.uk>
Date: Thu, 5 Jun 2008 10:38:33 +0100 (BST)


On Thu, 5 Jun 2008, Alasdair Allan wrote:

>>>> 4. hub provides hub-msg-id -> sender-msg-id translation method
>>>> - OK but slightly messy
>
> Ok, such is life. But... Do you mean the above, option 4?
>
> Up till now this hasn't been actually been functionality the Hub already had
> to implement. It merely had to generate a hub-msg-id that was resolvable (in
> some way) to the sender-msg-id. There was no requirement for the Hub to have
> to serialise this mapping.
>
> For instance I did this,
>
> my $hub_msg_id = $public_id . "_" . "$msg_id";
> $hub_msg_id =~ s/msg-id://;
> $hub_msg_id =~ s/client-id:/msg-id:/;
>
> where the public id is the $public_id of the originating app and the $msg_id
> was the sender-msg-id. Turning a $public_id = "client-d:dhgTjfv8jTYH7fg56kJL"
> and $msg_id = "msg-id:hhjYU6ttgR45dgHHcCvG" to this $hub_msg_id =
> "msg-id:dhgTjfv8jTYH7fg56kJL-hhjYU6ttgR45dgHHcCvG".
>
> So when it got a reply( ) all I did was this,
>
> my ( $public_id, $msg_id) = split "_", $hub_msg_id;
> $public_id =~ s/msg-id:/client-id:/;
> $msg_id = "msg-id:" . $msg_id;
>
> no state was necessary. Suddenly we're adding huge amounts of overhead to the
> Hub. It has to keep track of which message arrived from which sender, where
> it got dispatched to, it has to figure out when these expire (so it can clean
> out its backend cache of such things). Suddenly, there is all this overhead.
> I see absolutely no advantages of adding all this extra book work.

no - this requires no new state and no processing that you're not already having to do. The implementation of the new method I'm suggesting would, I think, be:

sub getSenderMsgId {

    my $self = shift;
    my $private_key = shift;
    my $hub_msg_id = shift;

    my ( $public_id, $msg_id ) = split "_", $hub_msg_id;     $msg_id = "msg-id:" . $msg_id;
    return $msg_id;
}

(but note: if I understand correctly, your implementation would *seem* to require for correct operation that the msg-id generated by the sender starts with the string "msg-id:" - this is not good. I think it's also vulnerable to sender-msg-ids which contain underscores).

-- 
Mark Taylor   Astronomical Programmer   Physics, Bristol University, UK
m.b.taylor@bris.ac.uk +44-117-928-8776 http://www.star.bris.ac.uk/~mbt/
Received on 2008-06-05Z11:38:34