Skip to content

Commit

Permalink
Moved the pub/sub sample to the new 3.0 configuration model
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasohlund committed Sep 26, 2011
1 parent ce986eb commit 5c1a650
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 46 deletions.
16 changes: 4 additions & 12 deletions Samples/PubSub/MyPublisher/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,18 @@
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
</configSections>


<!-- in order to configure remote endpoints use the format: "queue@machine"
input queue must be on the same machine as the process feeding off of it.
error queue can (and often should) be on a different machine.
-->
<MsmqTransportConfig NumberOfWorkerThreads="1" MaxRetries="5" />
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>

<MsmqTransportConfig
InputQueue="MyPublisherInputQueue"
ErrorQueue="error"
NumberOfWorkerThreads="1"
MaxRetries="5"
/>

<UnicastBusConfig
DistributorControlAddress=""
DistributorDataAddress=""
ForwardReceivedMessagesTo="">

<UnicastBusConfig LocalAddress="MyPublisherInputQueue">
<MessageEndpointMappings>
<!-- publishers don't need to set this for their own message types -->
<!--<add Messages="Messages" Endpoint="messagebus" />-->
Expand Down
Binary file modified Samples/PubSub/PubSub.suo
Binary file not shown.
11 changes: 4 additions & 7 deletions Samples/PubSub/Subscriber1/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@
<!--
This configuration section has been provided in code by implementing
IProvideConfiguration<MsmqTransportConfig>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
-->
<MsmqTransportConfig

ErrorQueue="error"
NumberOfWorkerThreads="1"
MaxRetries="5"
/>
<MsmqTransportConfig NumberOfWorkerThreads="1" MaxRetries="5" />

<UnicastBusConfig>

<UnicastBusConfig LocalAddress="Subscriber1InputQueue">
<MessageEndpointMappings>
<add Messages="MyMessages" Endpoint="MyPublisherInputQueue" />
</MessageEndpointMappings>
Expand Down
17 changes: 17 additions & 0 deletions Samples/PubSub/Subscriber1/ConfigOverride.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Subscriber1
{
using NServiceBus.Config;
using NServiceBus.Config.ConfigurationSource;

//demonstrate how to override specific configuration sections
class ConfigOverride : IProvideConfiguration<MessageForwardingInCaseOfFaultConfig>
{
public MessageForwardingInCaseOfFaultConfig GetConfiguration()
{
return new MessageForwardingInCaseOfFaultConfig
{
ErrorQueue = "error"
};
}
}
}
17 changes: 0 additions & 17 deletions Samples/PubSub/Subscriber1/EndpointConfig.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
using NServiceBus;
using NServiceBus.Config;
using NServiceBus.Config.ConfigurationSource;

namespace Subscriber1
{
class EndpointConfig : IConfigureThisEndpoint, AsA_Server {}

//demonstrate how to override specific configuration sections
class D : IProvideConfiguration<MsmqTransportConfig>
{
public MsmqTransportConfig GetConfiguration()
{
return new MsmqTransportConfig
{
ErrorQueue = "error",
InputQueue = "Subscriber1InputQueue",
MaxRetries = 5,
NumberOfWorkerThreads = 1
};
}
}
}
1 change: 1 addition & 0 deletions Samples/PubSub/Subscriber1/Subscriber1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<Compile Include="EndpointConfig.cs" />
<Compile Include="EventMessageHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ConfigOverride.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand Down
14 changes: 5 additions & 9 deletions Samples/PubSub/Subscriber2/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
</configSections>

<!-- in order to configure remote endpoints use the format: "queue@machine"
input queue must be on the same machine as the process feeding off of it.
error queue can (and often should) be on a different machine.
-->

<MsmqTransportConfig
InputQueue="Subscriber2InputQueue"
ErrorQueue="error"
NumberOfWorkerThreads="1"
MaxRetries="5"
/>

<UnicastBusConfig>
<MsmqTransportConfig NumberOfWorkerThreads="1" MaxRetries="5" />
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>

<UnicastBusConfig LocalAddress="Subscriber2InputQueue">
<MessageEndpointMappings>
<add Messages="MyMessages" Endpoint="MyPublisherInputQueue" />
</MessageEndpointMappings>
Expand Down
4 changes: 3 additions & 1 deletion Samples/PubSub/Subscriber2/Subscriber2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@
<Compile Include="Subscriber2Endpoint.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit 5c1a650

Please sign in to comment.