Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So I know enough about what happened to throw out an "Answer".</p> <p>When I setup my NServiceBus self hosting I had a call that loaded the message handlers.</p> <pre><code>NServiceBus.Configure.With().LoadMessageHandlers() </code></pre> <p>(There are more configurations, but I omitted them for brevity)</p> <p>When you call this, NServiceBus scans the assmeblies for a class that implements <code>IHandleMessages&lt;T&gt;</code>.</p> <p>So, somehow, on my Test Environment Machine, the ServiceBus scan of the directory for a class that calls IHandleMessages was failing to find my class (even though the assembly was absolutely there).</p> <p>Turns out that if NServiceBus does not find something that handles a message it will <strong>THROW IT AWAY</strong>!!!</p> <p>This is a total <strong>design bug</strong> in my opinion. The whole idea of NServiceBus is to not lose your data, but in this case it does just that!</p> <p>Now, once you know about this pitfall, there are several ways around it.</p> <ol> <li><p>Expressly state what your handler(s) should be:</p> <p><code>NServiceBus.Configure.With().LoadMessageHandlers&lt;First&lt;MyMessageType&gt;&gt;()</code></p></li> <li><p>Even further protection is to add another handler that will handle "Everything else". <code>IMessage</code> is the base for all message payloads, so if you put a handler on it, it will pickup everything.<br> If you set IMessage to <a href="http://docs.particular.net/nservicebus/handlers/handler-ordering" rel="nofollow">handle after</a> your messages get handled, then it will handle everything that NServiceBus can't find a handler for. If you throw and exception in that <code>Handle</code> method that will cause NServiceBus to to move the message to the <code>error</code> queue. (What I think should be the <strong>default</strong> behavior.)</p></li> </ol>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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