Свойства модели данных такие же. Одним из свойств является тип Enum. Потребитель и производитель – это отдельные проекты.
Конфигурация потребителя:
Код: Выделить всё
services.AddMassTransit(busConfig =>
{
busConfig.SetKebabCaseEndpointNameFormatter();
busConfig.AddConsumer();
busConfig.UsingRabbitMq((context, cfg) =>
{
IOptions messageQueueOptions = context.GetRequiredService();
IOptions queueOptions = context.GetRequiredService();
cfg.UseRawJsonDeserializer();
cfg.UseRawJsonSerializer();
cfg.Host(messageQueueOptions.Value.Uri, "/", rabbitConfig =>
{
rabbitConfig.Username(messageQueueOptions.Value.Username!);
rabbitConfig.Password(messageQueueOptions.Value.Password!);
});
cfg.ReceiveEndpoint(queueOptions.Value.ShooterGameQueue!, configEndpoint =>
{
configEndpoint.ConcurrentMessageLimit = 10;
configEndpoint.Bind(queueOptions.Value.ShooterGameExchange);
configEndpoint.UseRawJsonDeserializer();
configEndpoint.ConfigureConsumer(context);
});
});
});
Код: Выделить всё
serviceCollection.AddMassTransit(busConfig =>
{
busConfig.SetKebabCaseEndpointNameFormatter();
busConfig.AddConsumer();
busConfig.UsingRabbitMq((context, cfg) =>
{
IOptions messageQueueOptions = context.GetRequiredService();
IOptions queueOptions = context.GetRequiredService();
cfg.UseRawJsonDeserializer();
cfg.UseRawJsonSerializer();
cfg.Host(messageQueueOptions.Value.Uri, "/", rabbitConfig =>
{
rabbitConfig.Username(messageQueueOptions.Value.Username!);
rabbitConfig.Password(messageQueueOptions.Value.Password!);
});
#region ShooterGame
cfg.Message(topologyConfig =>
topologyConfig.SetEntityName(queueOptions.Value.ShooterGameExchange!));
cfg.Publish(publishConfig =>
{
publishConfig.Durable = true;
publishConfig.AutoDelete = false;
publishConfig.ExchangeType = "fanout";
});
#endregion
#region Transactions
cfg.ReceiveEndpoint(queueOptions.Value.TransactionsQueue!, configEndpoint =>
{
configEndpoint.ConfigureConsumeTopology = false;
configEndpoint.ConcurrentMessageLimit = 10;
configEndpoint.Bind(queueOptions.Value.TransactionsExchange);
configEndpoint.UseRawJsonDeserializer();
configEndpoint.ConfigureConsumer(context);
});
#endregion
});
});
Подробнее здесь: https://stackoverflow.com/questions/790 ... pped-queue
Мобильная версия