1- # Pandatech.MassTransit.PostgresOutbox
1+ - [ 1. Pandatech.MassTransit.PostgresOutbox] ( #1-pandatechmasstransitpostgresoutbox )
2+ - [ 1.1. Features] ( #11-features )
3+ - [ 1.2. Getting Started] ( #12-getting-started )
4+ - [ 1.3. Installation] ( #13-installation )
5+ - [ 1.4. Configuration] ( #14-configuration )
6+ - [ 1.5. Usage] ( #15-usage )
7+ - [ 1.5.1. Configuration] ( #151-configuration )
8+ - [ 1.5.2. Publishing Messages (Outbox Pattern)] ( #152-publishing-messages-outbox-pattern )
9+ - [ 1.5.3. Consuming Messages (Inbox Pattern)] ( #153-consuming-messages-inbox-pattern )
10+ - [ 1.6. License] ( #16-license )
11+
12+ # 1. Pandatech.MassTransit.PostgresOutbox
213
314Welcome to the Pandatech MassTransit PostgreSQL Outbox Extension repository. This library is designed to enhance
415MassTransit's capabilities by introducing robust support for the Outbox and Inbox patterns with a particular focus on
516PostgreSQL, alongside seamless integration with multiple DbContexts in Entity Framework Core. This extension is ideal
617for developers seeking to ensure reliable message delivery and processing in distributed, microservice-oriented
718architectures.
819
9- ## Features
20+ ## 1.1. Features
1021
1122- ** Multiple DbContext Support** : Operate within complex systems using multiple data contexts without hassle.
1223- ** Outbox Pattern Implementation** : Reliably handle message sending operations, ensuring no messages are lost in
@@ -17,23 +28,23 @@ architectures.
1728 control, making your message handling processes more robust.
1829- ** Seamless Integration** : Designed to fit effortlessly into existing MassTransit and EF Core based projects.
1930
20- ## Getting Started
31+ ## 1.2. Getting Started
2132
2233To get started with the Pandatech MassTransit PostgreSQL Outbox Extension, ensure you have the following prerequisites:
2334
2435- .NET Core 8 or later
2536- An existing MassTransit project
2637- PostgreSQL database
2738
28- ## Installation
39+ ## 1.3. Installation
2940
3041The library can be installed via NuGet Package Manager. Use the following command:
3142
3243``` bash
3344Install-Package Pandatech.MassTransit.PostgresOutbox
3445```
3546
36- ## Configuration
47+ ## 1.4. Configuration
3748
3849Before diving into the usage, it's essential to configure the Pandatech MassTransit PostgreSQL Outbox Extension in your
3950application. This involves setting up your DbContexts, configuring MassTransit to use the extension, and initializing
@@ -42,47 +53,45 @@ the Outbox and Inbox features.
4253Stay tuned for the next sections where we'll cover the usage details, showcasing how you can leverage this powerful
4354extension to enhance your distributed systems.
4455
45- ## Usage
56+ ## 1.5. Usage
57+
4658Take into account that examples below are given for configuring both inbox and outbox patterns.
47- If you need only one of those , consider using appropriate methods available(eg. instead of AddOutboxInboxServices use AddInboxServices and etc).
59+ If you need only one of those , consider using appropriate methods available(eg. instead of AddOutboxInboxServices use
60+ AddInboxServices and etc).
4861
49- Configuration
62+ ### 1.5.1. Configuration
5063
51- Entity Configuration: Ensure your DbContext implements the IOutboxDbContext and IInboxDbContext interfaces.
52- Configure your entities and generate migrations.
53- Call ConfigureInboxOutboxEntities on your ModelBuilder to configure the necessary tables for inbox and outbox patterns.
64+ ** Entity Configuration:** Ensure your ` DbContext ` implements the ` IOutboxDbContext ` and ` IInboxDbContext ` interfaces.
65+ Configure your entities and generate migrations.
66+ Call ` ConfigureInboxOutboxEntities ` on your ` ModelBuilder ` to configure the necessary tables for inbox and outbox patterns.
5467
5568``` csharp
56-
5769protected override void OnModelCreating (ModelBuilder modelBuilder )
5870{
5971 modelBuilder .ConfigureInboxOutboxEntities ();
6072}
6173```
62-
63- And you need to call UseQueryLocks() inside AddDbContext or AddDbContextPool , this needs for enabling ForUpdate feature.
64-
74+ And you need to call ` UseQueryLocks() ` inside ` AddDbContext ` or ` AddDbContextPool ` , this needs for enabling ` ForUpdate `
75+ feature.
6576``` csharp
66- builder .Services .AddDbContextPool <PostgresContext >(options =>
77+ builder .Services .AddDbContextPool <PostgresContext >(options =>
6778 options .UseNpgsql (connectionString )
6879 .UseQueryLocks ());
6980```
7081
71- Service Registration: Register essential services on startup, specifying the DbContext type.
82+ ** Service Registration:** Register essential services on startup, specifying the ` DbContext ` type.
7283You can optionally override settings(its optional parameter).
7384
7485``` csharp
75-
7686services .AddOutboxInboxServices <PostgresContext >();
7787```
7888
79- Publishing Messages (Outbox Pattern)
89+ ### 1.5.2. Publishing Messages (Outbox Pattern)
8090
81- To publish a message using the outbox pattern, call the AddToOutbox method on your DbContext,
82- specifying your message. Remember to call SaveChanges() to persist the message to the database.
91+ To publish a message using the outbox pattern, call the ` AddToOutbox ` method on your ` DbContext ` ,
92+ specifying your message. Remember to call ` SaveChanges() ` to persist the message to the database.
8393
8494``` csharp
85-
8695dbContext .Orders .Add (new Order
8796{
8897 Amount = 555 ,
@@ -96,10 +105,10 @@ dbContext.AddToOutbox(new OrderCreatedEvent());
96105dbContext .SaveChanges ();
97106```
98107
99- Consuming Messages (Inbox Pattern)
108+ ### 1.5.3. Consuming Messages (Inbox Pattern)
100109
101110To consume messages using the inbox pattern, create a consumer that inherits from
102- InboxConsumer<TMessage, TDbContext> class, specifying the message type and DbContext type as generic arguments.
111+ ` InboxConsumer<TMessage, TDbContext> ` class, specifying the message type and ` DbContext ` type as generic arguments.
103112
104113``` csharp
105114
@@ -120,6 +129,6 @@ public class YourConsumer : InboxConsumer<YourMessage, PostgresContext>
120129}
121130```
122131
123- ## License
132+ ## 1.6. License
124133
125134Pandatech.MassTransit.PostgresOutbox is licensed under the MIT License.
0 commit comments