Monday, August 3, 2009

Peeking in .Net Service Bus "Router "

The pass two day, i played with the "Router" a little bit, and try to find out what the router can do for us.



The pic above was quoted from the .net service bus white paper. As we can see that, Router can distribute message to a queue, a receiver or another router.

Ok, time for criticism:

Cons:

(a) Messages are directed in OneWay only.
Which means the relationship can only be One Sender --> Multi Receiver,
receiver can not interact with the sender.

(b) the queue need to be specify by the receiver.
I am a bit confusing in here as well.


<1> I cannot see big differents or important differents between the two receiver showed in the above pic.
I use the sample code which came alone with the .net service sdk (publisher subscriber).
I made the publisher keep sending message. When Service B and A both launched.
Messages displayed by Service B always random.
for example, the sender keep sending number in acceding order e.g 1 2 3 4 5 6 7 8 9 ,
bur what B received would be 4 6 1 8 9 2 3 5, and B keep doing like this.

The same thing happened on Service A as well, at the beginning, there is no order...
but after a little while, we can see the message displayed by Service A would become the same order as what the sender did.

but it doesn`t make sense to me, why at the beginning, Service A display stuff is out of order???

<2> What more, the queue in the pic, didn`t act as what i expected.
I was thinking, even though service A might down for a while, when the next time it come up again, it wouldn`t miss any message, coz the message will store in the queue.
However, the result turn out is that, if Service A is down, the next time u come up, u can only receive the latest message, if something were sent in down time of service A, service A will just miss them.

(c) We can only play with the Router in .Net Technology.
Up till now, i have looked into both Java SDK in Jdotnetservice.com and Ruby SDK dotnetservicesruby.com

Seems neither of them support router.
And i tried to look into the REST approach of how the .Net technology can do the router thing,
seems it is not enough information for us to do everything on our own.

Maybe Microsoft should release a set of document, to show us how to connect to all its API.
To be honest, the java sdk is so shit, and too many over head request.

Pros:
(a) Sender can be down and up.
No matter what, a sender need to create a router into the service bus first.
After this, receiver can subscribe to the router.
And then sender would be allow down, up what ever time it wants, as long as it come back before the time out dration, which is 1 hours by default, and can be manually specify by the sender when creating the router.

(b) Receiver can ask the sender attache a secret key with all the message which is going to send to this receiver.
When the receiver subscribe to the router, the receiver can push a key to the router, ask the router attache that key with all message which will be send to this receiver.

(c) Load balance
Router can be configured to send message to "All" or send message to "One".
The usage of this kind of setting is that.

To "ALL" which means all the subscriber will receive the message.

To "One", if all the subscriber are the same set of service, either one of the service get the message from the router will do the job. In this case, the router will do the load balance job for you. The router will pick the most "Free" one, and send the message to that subscriber.

No comments:

Post a Comment