MassTransit In memory setup for memory setup for two different applications 运行 on the same process
MassTransit In memory setup for two different application running on same process
我有两个不同的应用程序,它们在同一个进程上 运行 通过为两个应用程序中的每一个创建 AppDomain。 application1 的总线设置如下所示:
builder.Register(c =>
{
var inMemoryTransportCache = new InMemoryTransportCache(Environment.ProcessorCount);
var bus = Bus.Factory.CreateUsingInMemory( sbc =>
{
sbc.SetTransportProvider(inMemoryTransportCache);
});
return bus.GetSendEndpoint(new Uri(busDestination)).Result;
}).As<ISendEndpoint>();
application2 的总线设置如下所示:
builder.Register(c =>
{
var inMemoryTransportCache = new InMemoryTransportCache(Environment.ProcessorCount);
var bus = Bus.Factory.CreateUsingInMemory(sbc =>
{
sbc.ReceiveEndpoint("TestQueue", ce =>
{
ce.LoadFrom(c);
});
sbc.SetTransportProvider(inMemoryTransportCache);
});
return bus;
})
.As<IBusControl>()
.As<IBus>()
.SingleInstance();
builder.Register(c => c.Resolve<IBusControl>().GetSendEndpoint(
new Uri("destinationUrl")).Result)
.As<ISendEndpoint>()
.SingleInstance();
当我从应用程序 1 向应用程序 2 发送消息时,应用程序 2 没有收到它。
从 masstransit 文档看来,除了接收端点之外,当 运行 在内存中时,我们不必指定任何其他内容。
我是不是设置有误?即当 运行 在内存中时,目标 url 是否重要。
我还必须在 application2 中指定消费者吗?
如有任何帮助,我们将不胜感激。(使用公共交通版本 3.4.1)
单独的 AppDomains 有单独的内存 space,因此无法共享相同的传输。因此,您不能将 InMemoryTransport 用于 AppDomain 间通信。相信我,如果你可以,那就太棒了,但你不能。
你为什么要使用两个单独的 AppDomain?如果您可以将其折叠成一个域,它将按预期工作。
我有两个不同的应用程序,它们在同一个进程上 运行 通过为两个应用程序中的每一个创建 AppDomain。 application1 的总线设置如下所示:
builder.Register(c =>
{
var inMemoryTransportCache = new InMemoryTransportCache(Environment.ProcessorCount);
var bus = Bus.Factory.CreateUsingInMemory( sbc =>
{
sbc.SetTransportProvider(inMemoryTransportCache);
});
return bus.GetSendEndpoint(new Uri(busDestination)).Result;
}).As<ISendEndpoint>();
application2 的总线设置如下所示:
builder.Register(c =>
{
var inMemoryTransportCache = new InMemoryTransportCache(Environment.ProcessorCount);
var bus = Bus.Factory.CreateUsingInMemory(sbc =>
{
sbc.ReceiveEndpoint("TestQueue", ce =>
{
ce.LoadFrom(c);
});
sbc.SetTransportProvider(inMemoryTransportCache);
});
return bus;
})
.As<IBusControl>()
.As<IBus>()
.SingleInstance();
builder.Register(c => c.Resolve<IBusControl>().GetSendEndpoint(
new Uri("destinationUrl")).Result)
.As<ISendEndpoint>()
.SingleInstance();
当我从应用程序 1 向应用程序 2 发送消息时,应用程序 2 没有收到它。
从 masstransit 文档看来,除了接收端点之外,当 运行 在内存中时,我们不必指定任何其他内容。
我是不是设置有误?即当 运行 在内存中时,目标 url 是否重要。 我还必须在 application2 中指定消费者吗?
如有任何帮助,我们将不胜感激。(使用公共交通版本 3.4.1)
单独的 AppDomains 有单独的内存 space,因此无法共享相同的传输。因此,您不能将 InMemoryTransport 用于 AppDomain 间通信。相信我,如果你可以,那就太棒了,但你不能。
你为什么要使用两个单独的 AppDomain?如果您可以将其折叠成一个域,它将按预期工作。