send a message to a specific destination on a specific instance

I am migration from Nservicebus 5 to 7.1

I have a use case that I need to send a message to a specific destination on a specific instance. however, changing both of them on a single send option raises an exception

var options = new SendOptions();
await context.Send(x =>
x.ActionId = actionToRun.Id;
x.ExecutionId = executionId;
}, options).ConfigureAwait(false);

These two send options are not compatible with each other, that’s also why you’re seeing an exception when trying to combine those.

  • RouteToSpecificInstance is an additional information to NServiceBus’ routing logic to let it know that you don’t want to send it to any potential instance of a scaled out endpoint but to a very specific instance. This instance usually needs to be configured using MakeInstanceUniquelyAddressable using the same discriminator value as passed to the RouteToSpecificInstance option.
  • SetDestination bypasses all of NServiceBus routing logic and will just try to send the message to the address/queue specificed in the parameter. You cannot specify additional routing logic as NServiceBus will just send the message to the given value.