Skip to content

Commit

Permalink
fix: allow specify custom port in the rabbitmq config
Browse files Browse the repository at this point in the history
  • Loading branch information
Artonus committed Apr 5, 2024
1 parent 72e2526 commit 134d826
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/Common/Config/RabbitMqConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ public class RabbitMqConfig
/// RabbitMQ broker address
/// </summary>
public string Address { get; set; }

/// <summary>
/// Password
/// </summary>
public ushort? Port { get; set; }
/// <summary>
/// User
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public static IServiceCollection RegisterRabbitMqConsumers(this IServiceCollecti

x.UsingRabbitMq((busRegistrationContext, mqBusFactoryConfigurator) =>
{
mqBusFactoryConfigurator.Host(mqConfig.Address, "/", hostConfig =>
var port = mqConfig.Port ?? 5672;
mqBusFactoryConfigurator.Host(mqConfig.Address, port , "/", hostConfig =>
{
hostConfig.Username(mqConfig.User);
hostConfig.Password(mqConfig.Pass);
Expand Down
3 changes: 2 additions & 1 deletion src/OcelotGateway/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"RabbitMQ": {
"Address": "",
"User": "",
"Pass": ""
"Pass": "",
"Port": ""
},
"Middleware": {
"Organization": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public static IServiceCollection RegisterRabbitMqConsumers(this IServiceCollecti

x.UsingRabbitMq((busRegistrationContext, mqBusFactoryConfigurator) =>
{
mqBusFactoryConfigurator.Host(mqConfig.Address, "/", hostConfig =>
var port = mqConfig.Port ?? 5672;
mqBusFactoryConfigurator.Host(mqConfig.Address, port, "/", hostConfig =>
{
hostConfig.Username(mqConfig.User);
hostConfig.Password(mqConfig.Pass);
Expand Down
3 changes: 2 additions & 1 deletion src/Orchestrator/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"RabbitMQ": {
"Address": "",
"User": "",
"Pass": ""
"Pass": "",
"Port": ""
},
"Redis": {
"HostName": "Redis__HostName",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public static IServiceCollection RegisterRabbitMqConsumers(this IServiceCollecti

x.UsingRabbitMq((busRegistrationContext, mqBusFactoryConfigurator) =>
{
mqBusFactoryConfigurator.Host(mqConfig.Address, "/", hostConfig =>
var port = mqConfig.Port ?? 5672;
mqBusFactoryConfigurator.Host(mqConfig.Address, port, "/", hostConfig =>
{
hostConfig.Username(mqConfig.User);
hostConfig.Password(mqConfig.Pass);
Expand Down
3 changes: 2 additions & 1 deletion src/ResourcePlanner/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"RabbitMQ": {
"Address": "",
"User": "",
"Pass": ""
"Pass": "",
"Port": ""
},
"Slice": {
"Hostname": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public static IServiceCollection RegisterRabbitMqPublishers(this IServiceCollect
{
x.UsingRabbitMq((busRegistrationContext, mqBusFactoryConfigurator) =>
{
mqBusFactoryConfigurator.Host(mqConfig.Address, "/", hostConfig =>
var port = mqConfig.Port ?? 5672;
mqBusFactoryConfigurator.Host(mqConfig.Address, port, "/", hostConfig =>
{
hostConfig.Username(mqConfig.User);
hostConfig.Password(mqConfig.Pass);
Expand Down
3 changes: 2 additions & 1 deletion src/TaskPlanner/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"RabbitMQ": {
"Address": "",
"User": "",
"Pass": ""
"Pass": "",
"Port": ""
},
"Redis": {
"HostName": "",
Expand Down

0 comments on commit 134d826

Please sign in to comment.