Database Reference
In-Depth Information
In a gateway, there are incoming channels and defined site keys to send outgoing mes-
sages to their sites. We can see in
App.config
of the headquarters that the receiving
channels for the headquarters are
http://localhost:25899/Headquarter/
and
http://localhost:25899/Headquarter2/
.
There will be a site keys set for the sending sites that make up
SiteA
and
SiteB
:
The site keys are used for
Bus.SendToSites(new[] { "SiteA", "SiteB"}
,
which will take in an array of keys to send the messages to their sites. For instance, the
parameter of
SiteA
will send the message to
http://localhost:25899/
SiteA/
.
Going across alternate channels such as HTTP means that you lose out on MSMQ's safety
guarantee of exactly one message. This means that communication errors resulting in re-
tries can lead to receiving messages more than once. To avoid burdening you with dedu-
plication, the NServiceBus gateway supports this out of the box. You just need to store the
message IDs of all the received messages so it can detect potential duplicates. The dedu-
plication code can be stored in SQL Server using the NHibernate persistence configura-
tion. This will be configured on IBus using
.UseNHibernateGatewayDeduplica-
tion()
. Of course, settings always need to be applied in the
App.config
file to
define the database connection. Here, we are connecting to the local
SQLExpress
in-
stance.