Sample Header Ad - 728x90

Is it good idea to invoke Web Service from the database function or trigger?

1 vote
1 answer
2018 views
I am using PostgreSQL in my Web API project. I have created Web APIs using .net core. Now I have a situation, where I want to process the inserted or updated data and store the processed data in some other table. I was thinking to create a trigger for the table that will invoke the REST API created in .net core along with the data and in .net core, I can easily process the data and will insert it into the table I want. The API will be **OneWay web service - i.e. fire and forget.** But I was wondering, whether it is a good idea to invoke web service from the database? If it is, then how could I invoke a OneWay Web service from Postgres trigger? Another approach I found was to use LISTEN/NOTIFY. For this approach, https://shashangka.com/2020/05/17/listen-postgresql-in-asp-net-core/ article seems fine. I was wondering, which of the approach will be better for my use case and why?
Asked by Sunny (145 rep)
Oct 29, 2020, 06:35 AM
Last activity: Oct 29, 2020, 07:19 AM