Section III - module
To create the module, create a new file named processor.rs in the /src directory.
We inherit most of our use
declarations from lib.rs
using the use super::*;
statement, but there is the kafka consumer use
to add.
Tests
Add the following unit test to the bottom of the module.
Code
Because the processor executable is a stand-alone microservice, we will follow an Object Oriented Design. This means we first define the OrderStatusProcessor
object.
We then give the object functionality by using the impl OrderStatusProcessor {...}
syntax. The constructor for the OrderStatusProcessor
object is the new()
function that returns a OrderStatusProcessor
object.
Now is a good time to rerun the
cargo test
command to ensure all your tests still pass.
Last updated
Was this helpful?