Skip to content

Commit 4fd4e32

Browse files
authored
Fix README API drift against current Cleipnir.NET surface (#7)
1 parent 519e943 commit 4fd4e32

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ await Capture(() => httpClient.PostAsync("https://someurl.com", content), RetryP
4141
### Messages
4242
Wait for retrieval of external message - without consuming resources:
4343
```csharp
44-
var fundsReserved = await Message<FundsReserved>(waitFor: TimeSpan.FromMinutes(5));
44+
var fundsReserved = await Message<FundsReserved>();
4545
```
4646
### Suspension
4747
Suspends execution for a given duration (without taking up in-memory resources) - after which it will resume automatically from the same point.
@@ -174,6 +174,7 @@ public class OrderFlow(IBus bus) : Flow<Order>
174174
await PublishSendOrderConfirmationEmail(order, trackAndTraceNumber);
175175
await Message<OrderConfirmationEmailSent>();
176176
}
177+
}
177178
```
178179

179180
The implemented flow can then be started using the corresponding source generated Flows-type ([source code](https://github.com/stidsborg/Cleipnir.NET.Sample/blob/main/Source/Flows/Ordering/Rpc/OrderController.cs)):
@@ -307,7 +308,7 @@ var testOrder = new Order("MK-54321", CustomerId: Guid.NewGuid(), ProductIds: [G
307308
await flows.Run(
308309
instanceId: testOrder.OrderId,
309310
testOrder,
310-
new InitialState(Messages: [], Effects: [new InitialEffect("TransactionId", transactionId)])
311+
new InitialState(Messages: [], Effects: [new InitialEffect(Id: 0, Value: transactionId, Alias: "TransactionId")])
311312
);
312313

313314
Assert.AreEqual(transactionId, usedTransactionId);
@@ -359,7 +360,7 @@ await messageWriter.AppendMessage(new FundsReserved(orderId), idempotencyKey: na
359360
```csharp
360361
var controlPanel = await flows.ControlPanel(flowId);
361362
controlPanel!.Param = "valid parameter";
362-
await controlPanel.Restart(clearFailures: true);
363+
await controlPanel.ScheduleRestart(clearFailures: true).Completion();
363364
```
364365

365366
### Postpone a running flow (without taking in-memory resources) ([source code](https://github.com/stidsborg/Cleipnir.NET/blob/b842b8bdb7367ddd86e8962017c520dadf3a27b2/Samples/Cleipnir.Flows.Samples.Console/Postpone/PostponeFlow.cs#L13)):
@@ -410,7 +411,7 @@ Consider the following Order-flow:
410411
```csharp
411412
public class OrderFlow(IPaymentProviderClient paymentProviderClient, IEmailClient emailClient, ILogisticsClient logisticsClient) : Flow<Order>
412413
{
413-
public async Task ProcessOrder(Order order)
414+
public override async Task Run(Order order)
414415
{
415416
Log.Logger.ForContext<OrderFlow>().Information($"ORDER_PROCESSOR: Processing of order '{order.OrderId}' started");
416417

@@ -437,7 +438,7 @@ The payment provider requires the caller to provide a transaction-id. Thus, the
437438
In Cleipnir this challenge is solved by wrapping non-determinism inside effects.
438439

439440
```csharp
440-
public async Task ProcessOrder(Order order)
441+
public override async Task Run(Order order)
441442
{
442443
Log.Logger.Information($"ORDER_PROCESSOR: Processing of order '{order.OrderId}' started");
443444

@@ -465,7 +466,7 @@ As a result the order-flow must fail if it is restarted and:
465466
This can again be accomplished by using effects:
466467

467468
```csharp
468-
public async Task ProcessOrder(Order order)
469+
public override async Task Run(Order order)
469470
{
470471
Log.Logger.Information($"ORDER_PROCESSOR: Processing of order '{order.OrderId}' started");
471472

@@ -496,8 +497,8 @@ For instance, assuming it is determined that the products where not shipped for
496497

497498
```csharp
498499
var controlPanel = await flows.ControlPanel(order.OrderId);
499-
await controlPanel!.Effects.Remove("ShipProducts");
500-
await controlPanel.Restart();
500+
await controlPanel!.Effects.Remove(shipProductsEffectId);
501+
await controlPanel.ScheduleRestart().Completion();
501502
```
502503

503504
### Message-based Solution
@@ -516,7 +517,7 @@ Cleipnir.NET solves these challenges by building on the primitives described abo
516517
As a result the order-flow can be implemented as follows:
517518

518519
```csharp
519-
public async Task ProcessOrder(Order order)
520+
public override async Task Run(Order order)
520521
{
521522
Log.Logger.Information($"ORDER_PROCESSOR: Processing of order '{order.OrderId}' started");
522523

0 commit comments

Comments
 (0)