人
我正在尝试向服务器发送消息并在客户端获得响应,我也尝试使用相同的端点在服务器上发布另一条消息。
我在客户端没有收到回复,但订阅者获得成功发布的消息
服务器端代码:
if (!someCondition)
{
_bus.Reply(new BookingStatus(message, Status.Occupied));
}
else
{
_bus.Reply(new BookingStatus(message, Status.Ok));
_bus.Publish(new RoomBooked(message, Guid.NewGuid()));
//some logic
}
配置总线代码:
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("NServiceBusDemo");
busConfiguration.UseTransport<MsmqTransport>();
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.AutoSubscribe();
DefaultFactory defaultFactory = LogManager.Use<DefaultFactory>();
defaultFactory.Directory(@"..\..\..\logs");
defaultFactory.Level(LogLevel.Warn);
var bus = Bus.Create(busConfiguration);
return bus;