Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
Signed-off-by: kjuulh <contact@kjuulh.io>
  • Loading branch information
kjuulh committed Sep 24, 2023
1 parent 65d04a4 commit 7ff05b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@ The value of crunch is that you can separate your own business domain from other
See [examples](crates/crunch/examples/) for a more holistic listing of features

```rust
impl Event for SomeEvent {
fn event_info(&self) -> EventInfo {
EventInfo {
domain: "some-domain",
entity_type: "some-entity",
}
}
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let in_memory = Persistence::in_memory();
OutboxHandler::new(in_memory.clone()).spawn();
let publisher = Publisher::new(in_memory);
let crunch = crunch::Builder::default().build()?;

crunch.subscribe(|event| async move {
println!("received event: {:?}", event);

Ok(())
})
.await?;

publisher
crunch
.publish(SomeEvent {
name: "some-name".into(),
})
Expand Down Expand Up @@ -67,7 +63,7 @@ See [docs](docs/index.md) for more information (TBA)
When crunch is used in services it needs some supportive tooling, it isn't a requirement, but it helps ease development when using them.

- [x] [Cli](crates/crunch-cli) Used to generate code, add subscriptions, publish event schema, bump versions and more
- [x] Codegen done
- [x] Codegen done (at least for an alpha)
- [ ] Rest
- [x] [Codegen](crates/crunch-codegen) Can be used to automatically generate rust code depending on your crunch.toml file
- [x] Main serialization and protobuf -> rust
Expand Down
3 changes: 2 additions & 1 deletion crates/crunch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ impl std::ops::Deref for Crunch {
}
}

pub mod builder {
pub use builder::*;
mod builder {
use crate::{errors, Crunch, OutboxHandler, Persistence, Publisher, Subscriber, Transport};

#[derive(Clone)]
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-setup/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use gencrunch::basic::{includes::my_include::MyInclude, my_event::MyEvent};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let crunch = ::crunch::builder::Builder::default().build()?;
let crunch = crunch::Builder::default().build()?;

crunch
.subscribe(|item: MyEvent| async move {
Expand Down

0 comments on commit 7ff05b0

Please sign in to comment.