Skip to content

Commit

Permalink
feat: replay wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
ljacobsson committed Nov 7, 2020
1 parent f749a60 commit 58c5536
Show file tree
Hide file tree
Showing 6 changed files with 391 additions and 18 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ Options:
```
Example event input can be found [here](tests/test-event.json)

## Replay events
```
Usage: evb replay|r [options]
Tests an event payload against existing rules on a bus
Options:
-b, --eventbus [eventbus] The eventbus the archive is stored against (default: "default")
-r, --rule-prefix [rulePrefix] Rule name prefix
```

## Local debugging
Local debugging makes use to API Gateway V2 websockets to forward actual events in the cloud to your developer machine. The requires a [Serverless Application Repository app](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/751354400372/evb-local) to be installed in your account. Note that depending on your traffic, there will be some small effect on your billing in the form of Lambda invocations, API Gateway invocations, CloudWatch Logs and DynamoDB R/W.

Expand Down
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const localPatternListener = require("./src/evb-local/listeners/localPatternList
const arnListener = require("./src/evb-local/listeners/arnListener");
const package = require('./package.json');
const eventTester = require("./src/event-tester");
const replayBuilder = require("./src/replay-builder");
require("@mhlabs/aws-sdk-sso");

process.env.AWS_SDK_LOAD_CONFIG = 1;
Expand Down Expand Up @@ -95,6 +96,17 @@ program
await eventTester.testEvent(cmd.eventInputFile, cmd.namePrefix, cmd.eventbus, cmd.all);
});

program
.command("replay")
.alias("r")
.option("-b, --eventbus [eventbus]", "The eventbus the archive is stored against", "default")
.option("-r, --rule-prefix [rulePrefix]", "Rule name prefix")
.description("Starts a replay of events against a specific destination")
.action(async (cmd) => {
initAuth(cmd);
await replayBuilder.replay(cmd.eventbus, cmd.rulePrefix);
});

const ruleDefault = "choose from template";
program
.command("local")
Expand Down
Loading

0 comments on commit 58c5536

Please sign in to comment.