0
votes

I want to configure an NServiceBus instance in order to use the SendLocal method, which works fine using the following code:

var bus = NServiceBus.Configure.With()
    .StructureMapBuilder()
    .XmlSerializer()
    .MsmqTransport()
        .PurgeOnStartup(true)
    .UnicastBus()
        .LoadMessageHandlers()
        .DoNotAutoSubscribe()
    .CreateBus()
    .Start();

 bus.SendLocal(new MyMessage());

However, doing this causes the message to be immediately processed. I would like the bus to not process the message but handle it in another AppDomain later using another NServiceBus instance.

Is it possible?

1

1 Answers

1
votes

You can use Bus.Send(msg) to another NServiceBus endpoint, when the NSB instance starts up, it can process the message.

Note, You need to configure the endpoint of another service in you app config like following

  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="MYCO.Messages.MyMessage" Endpoint="MyMessage.Another.Endpoint@localhost"/>
    </MessageEndpointMappings>
  </UnicastBusConfig>