Freigeben über


Solution to BrokerChallenge 0

It has been a week since I posted BrokerChallenge 0
and I am quite happy to see
several people successfully cracked it. Still others gave it a shot but
were not completely successful. So I decided to post the solution to
the challenge. You can get the sample T-SQL script from here
and modify it to suit your hostname, port and database name. With that
you are all set to BEGIN a dialog and SEND me a message. My
CommentService is still accepting messages although you will see your
name in the consolation list of the Hall of Fame.

Note: Several people who attempted to setup the broker stumbled
on firewall issues. While you might be tempted to think you don't need
to puncture your firewall since you are setting up the broker as an
initiator and not a target, your broker will never receive
acknowledgments to your sent messages. Hence the messages will never
get deleted from the sys.tranmission_queue. Also, you will not be able
to receive reply messages from the far broker. The reason for this is
connection arbitration. When your SQL Server instance creates an
outbound connection to my SQL Server instance, my instance sees the
remote TCP endpoint address to be that of your firewall gateway
(NAT/router). My instance does not see the private IP that may be used
inside your intranet or home-network; but that of your firewall
gateway. The target instance sends back the endpoint address back to
the initiator to arbitrate if the initiator is indeed who the target
thinks it is. Since this will fail, the connection will not be used for
sending messages or acks from the target back the initiator. Instead
the target will try to open a new connection to the initiator. Now if
your initiator address is private, there is no IP route to your machine
and hence it will not work. The solution is that if you control your
firewall (eg> the wireless router you use at home), open a port on
the router and redirect it to the port you use on your SQL server
instance. Also make sure you name your service using the external name
and not internal one (eg> tcp://24.16.11.66:3044 and not
tcp://192.168.1.10:4022).

Comments