Skip to content

Commit

Permalink
add pre-commit config
Browse files Browse the repository at this point in the history
Signed-off-by: Lance-Drane <[email protected]>
  • Loading branch information
Lance-Drane committed Aug 12, 2024
1 parent b492f05 commit cc08631
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
args: ['--unsafe']
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: local
hooks:
- id: fmt
name: fmt
description: Format files with cargo fmt.
entry: cargo fmt
language: system
types: [rust]
args: ["--"]
- id: cargo-check
name: cargo check
description: Check the package for errors.
entry: cargo check
language: system
types: [rust]
pass_filenames: false
- id: clippy
name: clippy
description: Lint rust sources
entry: cargo clippy
language: system
args: ["--", "-D", "warnings"]
types: [rust]
pass_filenames: false
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Currently only supports AMQP 0-9-1 as the broker protocol but can potentially su

The best way to install Rust is through [Rustup](https://www.rust-lang.org/tools/install).

You can format with `cargo fmt` and lint with `cargo clippy`
You can format with `cargo fmt` and lint with `cargo clippy` . There's also a pre-commit hook you can use ([installation instructions](https://pre-commit.com/#installation))

## Application startup

Expand Down Expand Up @@ -60,7 +60,7 @@ These instructions assume you are using the docker compose configuration and the
7) Click "publish_message". At this point the message should show up in the logs for both `http-2-broker` and `broker-2-http` .
8) On localhost:15673 `Queues and streams` section, blow up `Get messages`, set Ack mode to `Automatic ack`, click on `Get messages`, you should see your payload from step 6.

Congratulations, you have successfully simulated a publisher and a subscriber being able to talk to each other across 2 separate message brokers.
Congratulations, you have successfully simulated a publisher and a subscriber being able to talk to each other across 2 separate message brokers.

### Testing with INTERSECT-SDK directly

Expand All @@ -78,4 +78,4 @@ Now it's advisable to [run some INTERSECT-SDK examples](https://github.com/INTER

- one exchange for all messages (see `intersect_messaging.rs` to get name)
- routing keys will match SDK naming schematics (SOS hierarchy, "." as separator, end with ".{userspace|lifecycle|events}")
- queue name will also match SDK naming schematics (might need to be careful here, there's a 128 character limit here). This can really be whatever but we need to construct the queue name as something idempotent, we don't really want to have a billion durable queues floating around.
- queue name will also match SDK naming schematics (might need to be careful here, there's a 128 character limit here). This can really be whatever but we need to construct the queue name as something idempotent, we don't really want to have a billion durable queues floating around.
5 changes: 4 additions & 1 deletion http-2-broker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ pub async fn main() {
if exchange_result.is_err() {
let err = exchange_result.unwrap_err();
tracing::error!("could not create exchange: {}", err);
connection.close().await.expect("Could not close connection after failed exchange creation");
connection
.close()
.await
.expect("Could not close connection after failed exchange creation");
std::process::exit(1);
}
}
Expand Down

0 comments on commit cc08631

Please sign in to comment.