In Snowplow we have a raw event model (Snowplow Tracker Protocol) and an enriched event model.
For Sauna, when we have a queue/stream-based responder, such as Kinesis or Kafka, we need some kind of schema for the records ("commands") which are going to be written and read.
Still to be decided if xxx should be jsonschema or avro.
Avro
Because of the way that Avro works, the above would be difficult. There isn't a formal way in Avro for the child command entity to be properly typed within the command_envelope, unless the command_envelope defines all possible commands as a child union type.
We could formally define all possible commands as a child union type of the command_envelope. This has first-class support in Avro, but it is inflexible: we would need to know all the possible command types up-front.
Other solutions with Avro:
Stringly typing the child command (yuck)
Embedding the command_envelope inside the command, rather than the other way round (so it's just convention that every command type has a envelope property)
Some sort of wrapper around first class envelope and first class command (so one is not a child of the other, both are peers in Avro)
JSON Schema
In JSON Schema things are easier - as in Snowplow we can support heterogeneous entities, and we would just unmarshall the envelope and command pieces separately.
The other plus for JSON Schema is that it would be easier to add command support into Snowplow tracking SDKs. Because those SDKs already work heavily with JSON Schema, and because JSON Schema doesn't encourage upfront code-generation like Avro does...
Execute rules
Another idea for an execute rule is a ttl - this is so that you can put an expiry date on time-sensitive commands (e.g. abandoned shopping carts)...
In Snowplow we have a raw event model (Snowplow Tracker Protocol) and an enriched event model.
For Sauna, when we have a queue/stream-based responder, such as Kinesis or Kafka, we need some kind of schema for the records ("commands") which are going to be written and read.
One suggestion is something like this:
Or maybe they are peers:
Still to be decided if
xxx
should bejsonschema
oravro
.Avro
Because of the way that Avro works, the above would be difficult. There isn't a formal way in Avro for the child
command
entity to be properly typed within thecommand_envelope
, unless thecommand_envelope
defines all possiblecommand
s as a child union type.We could formally define all possible
command
s as a child union type of thecommand_envelope
. This has first-class support in Avro, but it is inflexible: we would need to know all the possible command types up-front.Other solutions with Avro:
command_envelope
inside the command, rather than the other way round (so it's just convention that every command type has aenvelope
property)JSON Schema
In JSON Schema things are easier - as in Snowplow we can support heterogeneous entities, and we would just unmarshall the
envelope
andcommand
pieces separately.The other plus for JSON Schema is that it would be easier to add command support into Snowplow tracking SDKs. Because those SDKs already work heavily with JSON Schema, and because JSON Schema doesn't encourage upfront code-generation like Avro does...
Execute rules
Another idea for an execute rule is a ttl - this is so that you can put an expiry date on time-sensitive commands (e.g. abandoned shopping carts)...