Skip to content

rafaelpadovezi/bookmark-manager

Repository files navigation

Bookmark Manager

A simple bookmark manager written in C#

Technologies

  • aspnet core 5
  • sql server
  • ef core 5
  • rabbit mq

Architecture

architecure

Adding a bookmark to Bookmark Manager is executed in two steps:

  1. Saves the provided URL on the DB and sends a message to RabbitMQ
  2. A consumer process the message fetching the url details from the site response

To make sure that bookmarks saved on te DB are always processed by the consumer it is used the Outbox Pattern.

In this implementation of the outbox pattern messages to be sent to RabbitMQ are saved on the DB and processed by a background service periodically. OutboxSendingService gets the messages not sent and publish them to the queue updating their status. This way is guaranteed that each message is sent at least one time.

For this reason, to the outbox pattern work is important that the consumer is idempotent. In this example, a separated table is used the store the processed messages. When commiting the transaction afer making changes to other entities the violation of the unique constraint error will occur and none of the change will be stored.

Running locally

# start dependencies
docker-compose up -d db queue

# see help
dotnet run -- -h

# run api
dotnet run -- api

# run consumer
dotnet run -- bookmark-inserted-consumer

References

About

A simple bookmark manager written in C#

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published