Skip to content

Commit

Permalink
Parse entity ids
Browse files Browse the repository at this point in the history
  • Loading branch information
huntc committed Sep 20, 2023
1 parent 385b28c commit c10f0f6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/iot-service/src/registration_projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ pub async fn task(
state_storage_path: PathBuf,
temperature_command: mpsc::Sender<Message<temperature::Command>>,
) {
// Establish our source of events either as a commit log or a gRPC
// connection, depending on our feature configuration.
// Establish our source of as a gRPC connection, and also setup
// an offset store to track the ordering of remote events. In so doing,
// we must also describe how an entity can be represented reliably as
// distinct keys to this store. In the case here, because our entity
// ids are numeric, we attempt a numeric conversion.

let stream_id = StreamId::from("registration-events");

Expand All @@ -40,7 +43,7 @@ pub async fn task(
EXPECTED_DISTINCT_REGISTRATIONS,
offset_store_id,
offset_store_receiver,
|_, _| None, // FIXME
|entity_id, _| entity_id.parse().ok(),
)
.await
});
Expand Down

0 comments on commit c10f0f6

Please sign in to comment.