Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot get self host to work on NServiceBus
    primarykey
    data
    text
    <p>Using version 2.0.0.1219</p> <p>I am attempting to self host both a subscriber and publisher with NServiceBus and VS2010. The programs run and initialize but I cannot get the messages to move across. The publisher acts like it is posting, no errors, but the subscriber receives nothing.</p> <p>Here is the subscriber config</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;configSections&gt; &lt;section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core"/&gt; &lt;section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/&gt; &lt;/configSections&gt; &lt;!-- 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. --&gt; &lt;MsmqTransportConfig InputQueue="loads" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5"/&gt; &lt;UnicastBusConfig&gt; &lt;MessageEndpointMappings&gt; &lt;add Messages="NServiceMessage" Endpoint="loads"/&gt; &lt;/MessageEndpointMappings&gt; &lt;/UnicastBusConfig&gt; &lt;startup&gt;&lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt;&lt;/startup&gt;&lt;/configuration&gt; </code></pre> <p>And the publisher config</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;configSections&gt; &lt;section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core"/&gt; &lt;section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/&gt; &lt;/configSections&gt; &lt;MsmqTransportConfig InputQueue="loads" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5"/&gt; &lt;UnicastBusConfig DistributorControlAddress="" DistributorDataAddress="" ForwardReceivedMessagesTo=""&gt; &lt;MessageEndpointMappings&gt; &lt;!-- publishers don't need to set this for their own message types --&gt; &lt;!--&lt;add Messages="Messages" Endpoint="messagebus" /&gt;--&gt; &lt;/MessageEndpointMappings&gt; &lt;/UnicastBusConfig&gt; &lt;startup&gt; &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt; &lt;/startup&gt; &lt;/configuration&gt; </code></pre> <p>Here is the publisher code:</p> <pre><code> class Program { private static IBus _serviceBus; static void Main(string[] args) { _serviceBus = Configure.With() .Log4Net() .DefaultBuilder() .XmlSerializer() .MsmqSubscriptionStorage() .MsmqTransport() .UnicastBus() .LoadMessageHandlers() .CreateBus() .Start(); while (true) { Console.WriteLine("Press a key to send data."); Console.ReadKey(); SendMessaage(); } } private static void SendMessaage() { LoadMessage message = GetNextMessage(); _serviceBus.Publish(message); } private static LoadMessage GetNextMessage() { LoadMessage result = new LoadMessage(); result.DeliveryDate = DateTime.Today.AddDays(3).ToShortDateString(); result.DestinationCity = "Boise"; result.DestinationCountry = "USA"; result.DestinationState = "ID"; result.EventId = Guid.NewGuid(); result.Time = DateTime.Now.ToUniversalTime(); result.OriginState = "OR"; result.OriginCity = "Portland"; result.OriginCountry = "USA"; result.EquipmentID = 3; return result; } } </code></pre> <p>And the subscriber code</p> <pre><code> class Program { private static IBus _serviceBus; private static LoadMessageHandler _messageHandler; static void Main(string[] args) { _messageHandler = new LoadMessageHandler(); _serviceBus = Configure .With() .Log4Net() .DefaultBuilder() .BinarySerializer() .MsmqSubscriptionStorage() .MsmqTransport() .UnicastBus() .LoadMessageHandlers() .CreateBus() .Start(); Console.ReadKey(); } } </code></pre> <p>And the message code</p> <pre><code>public class LoadMessageHandler : IHandleMessages&lt;LoadMessage&gt; { public void Handle(LoadMessage message) { Console.WriteLine(String.Format("GUID: {0}", message.EventId)); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload