This repository has been archived by the owner on Sep 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
distributedeventbrokerscoping.html
55 lines (52 loc) · 3.1 KB
/
distributedeventbrokerscoping.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
layout: documentation
title: Distributed Event Broker
teaser: Appccelerates your local event broker until it fires over process boundaries
navigation:
- name: Tutorial
link: distributedeventbrokertutorial.html
- name: Transports
link: distributedeventbrokertransports.html
- name: Scoping & Identification
link: distributedeventbrokerscoping.html
- name: Customization
link: distributedeventbrokercustomization.html
- name: Restrictions
link: distributedeventbrokerrestrictions.html
---
<h2>Scoping & Identification</h2>
<h3>Distributed Event Broker Identification</h3>
<p><img src="img/distributedeventbrokeridentification.png" /> </p>
<p>The distributed event broker identification allows to bind several event brokers together. Only events fired in the same context are recognized from the event brokers participating in the context. That allows to have several distributed event brokers in one application. </p>
<p>Example (here with NServiceBus Transport): </p>
<script type="syntaxhighlighter" class="brush: csharp"><![CDATA[// App A
// Setup event broker and extension for business domain "X"
var extensionX = new NServiceBusDistributedEventBrokerExtension("DistributedEventBrokerX", bus);
eventBrokerX.AddDistributedExtension(extensionX);
// Setup event broker and extension for business domain "Y"
var extensionY = new NServiceBusDistributedEventBrokerExtension("DistributedEventBrokerY", bus);
eventBrokerY.AddDistributedExtension(extensionY);
// App B
// Setup event broker and extension for business domain "X"
var extensionX = new NServiceBusDistributedEventBrokerExtension("DistributedEventBrokerX", bus);
eventBrokerX.AddDistributedExtension(extensionX);
// App C
// Setup event broker and extension for business domain "Y"
var extensionY = new NServiceBusDistributedEventBrokerExtension("DistributedEventBrokerY", bus);
eventBrokerY.AddDistributedExtension(extensionY);
]]>
</script>
<p>Although eventBrokerX and eventBrokerY are running in the same process events published and handled on the distributed event broker of the business domain "X" are not seen on the distributed event broker of the business domain "Y" and vice versa. </p>
<h3>Event Broker Identification</h3>
<p>Each event broker can be identified by specifying an event broker identification. This information is just transmitted when an event is published without further impact on the distributed event broker. But it lets you distinguish from which location the event was coming from. </p>
<p>The identification can be specified by using the following <tt>AddDistributedExtension</tt> overload: </p>
<script type="syntaxhighlighter" class="brush: csharp"><![CDATA[
eventBroker.AddDistributedExtension(extension, "ApplicationXGlobalEventBroker");
]]>
</script>
<p>When using the extension method without specifying the event broker identification a new System.Guid is generated for each event broker. </p>
<script type="syntaxhighlighter" class="brush: csharp"><![CDATA[
// Will identify event broker by using System.Guid internally.
eventBroker.AddDistributedExtension(extension);
]]>
</script>