dotnetcore / CAP

Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern
http://cap.dotnetcore.xyz
MIT License
6.61k stars 1.28k forks source link

dotnet cap aws lose connection to database postgres in aws #1568

Closed Totot0 closed 1 month ago

Totot0 commented 1 month ago

I have a dotnet 7 api deploy on an aws container. This api uses dotnet cap 7.2.2 to use the RAbbitMq bus. At times I have an interruption to my bdd postgress and cap can not reconnect this. I am obliged to shut down my service and restart it

yang-xiaodong commented 1 month ago

The database operation is creating connections every time, you may need to check your network.

Totot0 commented 1 month ago

The problem is with the use of o.UsePostgresSql ` services.AddCap(o => { o.UseDashboard(opt => opt.PathMatch = "/outbox"); o.DefaultGroupName = "myApi"; o.TopicNamePrefix = configuration.GetValue("ENV"); o.GroupNamePrefix = configuration.GetValue("ENV");

            // Outbox storage
            o.UsePostgreSql(connectionString);

..... `

How do I know if I had a network outage on aws? Why is it not reconnecting automatically if the network is restored?

yang-xiaodong commented 1 month ago
  1. Try to use psql cli in ECS to see if the database can connects.
  2. Report the lose connection exception you mentioned.
yang-xiaodong commented 1 month ago

No response, closed!