Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Documentation/chronicle/event-store-subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ Event store subscriptions let one event store consume events produced in another
Lists all event store subscriptions configured for the target event store.

```bash
cratis chronicle event-store-subscriptions list --event-store <TARGET_EVENT_STORE>
cratis chronicle subscriptions list --event-store <TARGET_EVENT_STORE>
```

### Examples

List subscriptions for the `system` event store:

```bash
cratis chronicle event-store-subscriptions list --event-store system
cratis chronicle subscriptions list --event-store system
```

List in plain format:

```bash
cratis chronicle event-store-subscriptions list --event-store system --output plain
cratis chronicle subscriptions list --event-store system --output plain
```

## add

Adds an event store subscription to the target event store.

```bash
cratis chronicle event-store-subscriptions add <SUBSCRIPTION_ID> <SOURCE_EVENT_STORE> <EVENT_TYPES> --event-store <TARGET_EVENT_STORE>
cratis chronicle subscriptions add <SUBSCRIPTION_ID> <SOURCE_EVENT_STORE> <EVENT_TYPES> --event-store <TARGET_EVENT_STORE>
```

### Arguments
Expand All @@ -45,21 +45,21 @@ cratis chronicle event-store-subscriptions add <SUBSCRIPTION_ID> <SOURCE_EVENT_S
Add a subscription from `default` to `system` for one event type:

```bash
cratis chronicle event-store-subscriptions add orders-from-default default MyCompany.Sales.OrderPlaced --event-store system
cratis chronicle subscriptions add orders-from-default default MyCompany.Sales.OrderPlaced --event-store system
```

Add a subscription with multiple event types:

```bash
cratis chronicle event-store-subscriptions add sales-feed default MyCompany.Sales.OrderPlaced,MyCompany.Sales.OrderCancelled --event-store system
cratis chronicle subscriptions add sales-feed default MyCompany.Sales.OrderPlaced,MyCompany.Sales.OrderCancelled --event-store system
```

## remove

Removes an event store subscription from the target event store.

```bash
cratis chronicle event-store-subscriptions remove <SUBSCRIPTION_ID> --event-store <TARGET_EVENT_STORE>
cratis chronicle subscriptions remove <SUBSCRIPTION_ID> --event-store <TARGET_EVENT_STORE>
```

The command prompts for confirmation before proceeding. Pass `--yes` to skip the prompt in automated workflows.
Expand All @@ -68,7 +68,7 @@ The command prompts for confirmation before proceeding. Pass `--yes` to skip the

| Argument | Description |
|---|---|
| `SUBSCRIPTION_ID` | Identifier of the subscription to remove. Use `event-store-subscriptions list` to retrieve IDs. |
| `SUBSCRIPTION_ID` | Identifier of the subscription to remove. Use `subscriptions list` to retrieve IDs. |

### Options

Expand All @@ -81,11 +81,11 @@ The command prompts for confirmation before proceeding. Pass `--yes` to skip the
Remove a subscription interactively:

```bash
cratis chronicle event-store-subscriptions remove orders-from-default --event-store system
cratis chronicle subscriptions remove orders-from-default --event-store system
```

Remove without confirmation:

```bash
cratis chronicle event-store-subscriptions remove orders-from-default --event-store system --yes
cratis chronicle subscriptions remove orders-from-default --event-store system --yes
```
2 changes: 1 addition & 1 deletion Documentation/chronicle/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Commands that operate within a specific event store or namespace accept the foll
| `event-types` | List and inspect registered event type definitions. |
| `events` | Query events from an event sequence or retrieve the tail sequence number. |
| `observers` | List, inspect, replay, and retry observers. |
| `event-store-subscriptions` | Manage cross-event-store subscriptions for event forwarding. |
| `subscriptions` | Manage cross-event-store subscriptions for event forwarding. |
| `failed-partitions` | List and inspect partitions where an observer has failed. |
| `projections` | List and inspect projection definitions. |
| `read-models` | List, query, and inspect read model instances and snapshots. |
Expand Down
2 changes: 1 addition & 1 deletion Documentation/chronicle/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
href: events.md
- name: Observers
href: observers.md
- name: Event Store Subscriptions
- name: Subscriptions
href: event-store-subscriptions.md
- name: Failed Partitions
href: failed-partitions.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ async Task Because()
SubscriptionId = $"integration-test-subscription-{Guid.NewGuid():N}";
AddResult = await RunCliAsync(
"chronicle",
"event-store-subscriptions",
"subscriptions",
"add",
SubscriptionId,
"system",
"Integration.Test.EventType",
"--event-store",
"system");

var listResult = await RunCliAsync("chronicle", "event-store-subscriptions", "list", "--event-store", "system");
var listResult = await RunCliAsync("chronicle", "subscriptions", "list", "--event-store", "system");
var subscriptions = JsonDocument.Parse(listResult.StandardOutput).RootElement;
var testSubscription = subscriptions.EnumerateArray()
.FirstOrDefault(subscription => subscription.GetProperty("identifier").GetString() == SubscriptionId);
SubscriptionAppearedInList = testSubscription.ValueKind != JsonValueKind.Undefined;

if (SubscriptionAppearedInList)
{
RemoveResult = await RunCliAsync("chronicle", "event-store-subscriptions", "remove", SubscriptionId, "--event-store", "system", "--yes");
RemoveResult = await RunCliAsync("chronicle", "subscriptions", "remove", SubscriptionId, "--event-store", "system", "--yes");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Cratis.Cli.Commands.Chronicle.EventStoreSubscriptions;
/// </summary>
[LlmDescription("Adds an event store subscription to a target event store.")]
[CliCommand("add", "Add an event store subscription", Branch = typeof(ChronicleBranch.EventStoreSubscriptions))]
[CliExample("chronicle", "event-store-subscriptions", "add", "orders-from-default", "default", "MyCompany.Sales.OrderPlaced")]
[CliExample("chronicle", "subscriptions", "add", "orders-from-default", "default", "MyCompany.Sales.OrderPlaced")]
[LlmOutputAdvice("plain", "Plain outputs a simple confirmation message.")]
[LlmOption("<SUBSCRIPTION_ID>", "string", "The unique subscription identifier (positional)")]
[LlmOption("<SOURCE_EVENT_STORE>", "string", "The source event store to subscribe to (positional)")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Cratis.Cli.Commands.Chronicle.EventStoreSubscriptions;
/// </summary>
[LlmDescription("Lists event store subscriptions configured for the target event store.")]
[CliCommand("list", "List event store subscriptions", Branch = typeof(ChronicleBranch.EventStoreSubscriptions))]
[CliExample("chronicle", "event-store-subscriptions", "list", "--event-store", "system")]
[CliExample("chronicle", "subscriptions", "list", "--event-store", "system")]
[LlmOutputAdvice("plain", "Use plain for consistency with other listing commands.")]
public class ListEventStoreSubscriptionsCommand : ChronicleCommand<EventStoreSettings>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace Cratis.Cli.Commands.Chronicle.EventStoreSubscriptions;
/// Removes an event store subscription.
/// </summary>
[LlmDescription("Removes an event store subscription from a target event store. Destructive — prompts for confirmation unless --yes is specified.")]
[CliCommand("remove", "Remove an event store subscription", Branch = typeof(ChronicleBranch.EventStoreSubscriptions), DynamicCompletion = "event-store-subscriptions")]
[CliExample("chronicle", "event-store-subscriptions", "remove", "orders-from-default")]
[CliCommand("remove", "Remove an event store subscription", Branch = typeof(ChronicleBranch.EventStoreSubscriptions), DynamicCompletion = "subscriptions")]
[CliExample("chronicle", "subscriptions", "remove", "orders-from-default")]
[LlmOutputAdvice("plain", "Plain outputs a simple confirmation message.")]
[LlmOption("<SUBSCRIPTION_ID>", "string", "The unique subscription identifier to remove (positional)")]
public class RemoveEventStoreSubscriptionCommand : ChronicleCommand<RemoveEventStoreSubscriptionSettings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public class RemoveEventStoreSubscriptionSettings : EventStoreSettings
/// Gets or sets the subscription identifier.
/// </summary>
[CommandArgument(0, "<SUBSCRIPTION_ID>")]
[Description("Subscription identifier (from 'cratis chronicle event-store-subscriptions list')")]
[Description("Subscription identifier (from 'cratis chronicle subscriptions list')")]
public string SubscriptionId { get; set; } = string.Empty;
}
2 changes: 1 addition & 1 deletion Source/Cli/Commands/Completions/DynamicCompleteCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected override async Task<int> ExecuteCommandAsync(IServices services, Dynam

break;

case "event-store-subscriptions":
case "subscriptions":
var subscriptions = await services.EventStoreSubscriptions.GetSubscriptions(new GetEventStoreSubscriptionsRequest
{
TargetEventStore = eventStore
Expand Down
2 changes: 1 addition & 1 deletion Source/Cli/Registration/ChronicleBranch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static class Events { }
public static class Observers { }

/// <summary>Event store subscription management.</summary>
[CliBranch("event-store-subscriptions", "Manage event store subscriptions for cross-store event flow. Supports listing, adding, and removing subscriptions.")]
[CliBranch("subscriptions", "Manage event store subscriptions for cross-store event flow. Supports listing, adding, and removing subscriptions.")]
public static class EventStoreSubscriptions { }

/// <summary>Failed partition inspection.</summary>
Expand Down
Loading