I start the NServisBus.host.exe file from my wpf application using the following code:
System.Diagnostics.Process.Start("NServiceBus.Host.exe");
I have the following endpoint settings for my NServiceBus host:
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
{
}
I have the following class on my NServiceBus host server. I need to create this class object in my wpf application (after the NServiceBus.host.exe has been executed).
public class OrderMessaging
{
public IBus Bus { get; set; }
public void SendRouteMessageReceived(LabRoutingUpdateMessage routingUpdateMessage)
{
Bus.Send(new RouteMessageReceived(routingUpdateMessage));
}
}
I will then access this message class via it's referenced dll file (in my wpf app), and use the following code in my wpf application to send a message to the server:
OrderManagement.OrderMessaging routeMessageReceived = new OrderManagement.OrderMessaging();
routeMessageReceived.Bus = _bus; //Main problem is here! Wpf app does does not have handle on NServiceBus server Bus.
routeMessageReceived.SendRouteMessageReceived(_routing);
Is it possible for me to send a message to my NServiceBus.host.exe (when running using process.start) using a WPF application? Is there a way I can use custom initialization to host my own NServiceBus within my wpf app and still configure my endpoints correctly? Or is there a way I can get a handle on the Bus from within my wpf application? Any example code is greatly appreciated. Thanks in advance!