title: How to configure Rebus to have topics based on handlers' type
body: <p>I'm using Rebus and I want to introduce something like described in <a href="https://msdn.microsoft.com/en-us/library/jj591565.aspx" rel="nofollow">CQRS Journey</a> at paragraph "<strong>Avoid processing events multiple times</strong>", but I cannot figure it out.</p>
  
  <p>I configured Rebus to use SQL Server for <em>Transport</em> and MongoDB for <em>Subscriptions</em> and <em>Sagas</em>. The <em>Routing</em> is configured <em>TypeBased</em> and maps all the commands handlers' types to the queue configured in <em>Transport</em>.</p>
  
  <pre><code> var bus = Configure.With(new SimpleInjectorContainerAdapter(container))
              .Logging(l =&gt; l.Trace())
              .Transport(t =&gt;
              {
                  t.UseSqlServer(connectionstring, "TestMessages", "messageQueueName");
              })
              .Routing(r =&gt; r.TypeBased()
                              .MapAssemblyOf&lt;Assembly1.Commands.DoSomething&gt;("messageQueueName")
                              .MapAssemblyOf&lt;Assembly2.Commands.DoSomethingElse&gt;("messageQueueName")
                               )
              .Sagas(s =&gt; s.StoreInMongoDb(db, (sagaType) =&gt;
              {
                  return sagaType.Name;
              }))
              .Subscriptions(s =&gt; s.StoreInMongoDb(db, "Subscriptions"))
              .Options(o =&gt;
              {
                  o.SetNumberOfWorkers(1);
                  o.SetMaxParallelism(1);
                  o.EnableSagaAuditing().StoreInMongoDb(db, "Snapshots");
              })
              .Start();
  </code></pre>
  
  <p>Now I should configure Rebus in a way that when a command <em>Publish</em> an event, this is replicated in as many separate topics (virtual or physical queues) as existing subscribers' types.</p>
  
  <p>Something like:</p>
  
  <pre><code>bus.Subscribe&lt;Assembly1.EventHandler1&gt;("Assembly1.EventHandler1Queue").Wait();
  bus.Subscribe&lt;Assembly1.EventHandler2&gt;("Assembly1.EventHandler2Queue").Wait();
  bus.Subscribe&lt;Assembly2.EventHandler1&gt;("Assembly2.EventHandler1Queue").Wait();
  </code></pre>
  
  <p>Thanks for help.</p>