Skip to content

Commit

Permalink
Showing 3 changed files with 8 additions and 42 deletions.
4 changes: 2 additions & 2 deletions docs/guide/durability/marten/subscriptions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Event Subscriptions
# Event Subscriptions <Badge type="tip" text="2.2" />

::: tip
The older [Event Forwarding](./event-forwarding) feature is a subset of subscriptions, but happens at the time of event
capture whereas the event subscriptions are processed in strict order in a background process through Marten's [async daemon](https://martendb.io/events/projections/async-daemon.html)
subsystem. The **strong suggestion from the Wolverine team is to use one or the other approach, but not both in the same system**.
:::

New in Wolverine 2.2 is the ability to subscribe to Marten events to carry out message processing by Wolverine on
Wolverine has the ability to extend Marten's [event subscription functionality]() to carry out message processing by Wolverine on
the events being captured by Marten in strict order. This new functionality works through Marten's [async daemon](https://martendb.io/events/projections/async-daemon.html)

There are easy recipes for processing events through Wolverine message handlers, and also for just publishing events
44 changes: 5 additions & 39 deletions docs/guide/durability/postgresql.md
Original file line number Diff line number Diff line change
@@ -60,40 +60,6 @@ use this option which *also* activates PostgreSQL backed message persistence:
<!-- snippet: sample_using_postgres_transport -->
<a id='snippet-sample_using_postgres_transport'></a>
```cs
using var host = await Host.CreateDefaultBuilder()
.UseWolverine((context, opts) =>
{
var connectionString = context.Configuration.GetConnectionString("sqlserver");
opts.UseSqlServerPersistenceAndTransport(connectionString, "myapp")

// Tell Wolverine to build out all necessary queue or scheduled message
// tables on demand as needed
.AutoProvision()

// Optional that may be helpful in testing, but probably bad
// in production!
.AutoPurgeOnStartup();

// Use this extension method to create subscriber rules
opts.PublishAllMessages().ToSqlServerQueue("outbound");

// Use this to set up queue listeners
opts.ListenToSqlServerQueue("inbound")

.CircuitBreaker(cb =>
{
// fine tune the circuit breaker
// policies here
})

// Optionally specify how many messages to
// fetch into the listener at any one time
.MaximumMessagesToReceive(50);
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Persistence/PersistenceTests/Postgresql/Transport/DocumentationSamples.cs#L12-L46' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_using_postgres_transport' title='Start of snippet'>anchor</a></sup>
<a id='snippet-sample_using_postgres_transport-1'></a>
```cs
using var host = await Host.CreateDefaultBuilder()
.UseWolverine((context, opts) =>
{
@@ -125,18 +91,18 @@ using var host = await Host.CreateDefaultBuilder()
.MaximumMessagesToReceive(50);
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Persistence/PostgresqlTests/DocumentationSamples.cs#L12-L46' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_using_postgres_transport-1' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Persistence/PostgresqlTests/DocumentationSamples.cs#L12-L46' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_using_postgres_transport' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

The PostgreSQL transport is strictly queue-based at this point. The queues are configured as durable by default, meaning
that they are utilizing the transactional inbox and outbox. The PostgreSQL queues can also be buffered:

<!-- snippet: sample_setting_sql_server_queue_to_buffered -->
<a id='snippet-sample_setting_sql_server_queue_to_buffered'></a>
<!-- snippet: sample_setting_postgres_queue_to_buffered -->
<a id='snippet-sample_setting_postgres_queue_to_buffered'></a>
```cs
opts.ListenToSqlServerQueue("sender").BufferedInMemory();
opts.ListenToPostgresqlQueue("sender").BufferedInMemory();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Persistence/SqlServerTests/Transport/compliance_tests.cs#L65-L69' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_setting_sql_server_queue_to_buffered' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Persistence/PostgresqlTests/Transport/compliance_tests.cs#L61-L65' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_setting_postgres_queue_to_buffered' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Using this option just means that the PostgreSQL queues can be used for both sending or receiving with no integration
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ public class DocumentationSamples
{
public static async Task Bootstrapping()
{
#region sample_using_postgres_transport
#region sample_using_sqlserver_transport

using var host = await Host.CreateDefaultBuilder()
.UseWolverine((context, opts) =>

0 comments on commit e7cc312

Please sign in to comment.