>Thank you for your response. I had thought about
>minimizing the number of queues by 10 times -- like
>you just suggested. But, I did not know how to go
>about it. Sorry but, I seem to fail to understand your
>above explanation. Can you please bear with me and
>explain a bit more what you mean by the above? Hash
>value... Prime number, how are they created & used?

>Thanks again,

>Steve

Steve,

Well like I said there are many different ways you can achieve this and I
hesitate to suggest a way to do this because this list doesn't let one get
away with anything. So let me emphasise that this is *one* way you *could*
do this.

You need a constant, fairly random identifier associated with your client.
You might have a userid + department id or whatever. Let's say we use the
clients machine hostname.

Now add up the numeric characters in the name. ie. in C this could be

char * p   = HostName; /* null terminated hostname */
int    Key = 0;

while (*p) Key += *p++;


Now we have the ASCII total for the characters we then need to convert this
into one of 10 names. Well it's a lot easier to convert to prime numbers so
let's convert it to one of 11 names (closest prime).

int Hash = Key % 11;

The '%' operator gives us the modulus ie. what's left over after division,
the remainder.

So now we have a number, Hash, between 0 and 10 that is fairly evenly
spread across our clients.
We can then define 11 queues, ie. REPLYQ_0, REPLYQ_1,
REPLYQ_2......REPLYQ_10 and use the Hash number as part of the queue name
we open.

Does this make it any clearer ?

Cheers,
P.

Paul G Clarke
WebSphere MQ Development
IBM Hursley

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive

Reply via email to