Skip to content

Commit a3833c3

Browse files
feat(types): Updates the message type to have configurable fields
Also removes extensions as a guest configuration option (for now) Signed-off-by: Taylor Thomas <[email protected]>
1 parent 18318a5 commit a3833c3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: wit/types.wit

+10-3
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,33 @@ interface types {
2626
type channel = string;
2727

2828
/// Configuration includes a required list of channels the guest is subscribing to, and an
29-
/// optional list of extensions key-value pairs (e.g., partitions/offsets to read from in
30-
/// Kafka/EventHubs, QoS etc.).
29+
/// optional list of extensions key-value pairs
3130
record guest-configuration {
3231
channels: list<channel>,
33-
extensions: option<list<tuple<string, string>>>
3432
}
3533

3634
/// A message with a binary payload and additional information
3735
resource message {
3836
constructor(topic: channel, data: list<u8>, content-type: option<string>, metadata: option<list<tuple<string, string>>>);
3937
/// The topic/subject/channel this message was received or should be sent on
4038
topic: func() -> channel;
39+
/// Set the topic/subject/channel this message should be sent on
40+
set-topic: func(topic: channel);
4141
/// An optional content-type describing the format of the data in the message. This is
4242
/// sometimes described as the "format" type
4343
content-type: func() -> option<string>;
44+
/// Set the content-type describing the format of the data in the message. This is
45+
/// sometimes described as the "format" type
46+
set-content-type: func(content-type: string);
4447
/// An opaque blob of data
4548
data: func() -> list<u8>;
49+
/// Set the opaque blob of data for this message, discarding the old value
50+
set-data: func(data: list<u8>);
4651
/// Optional metadata (also called headers or attributes in some systems) attached to the
4752
/// message
4853
metadata: func() -> option<list<tuple<string, string>>>;
54+
/// Add a new key-value pair to the metadata, overwriting any existing value for the same key
55+
add-metadata: func(key: string, value: string);
4956

5057
/// Completes/acks the message
5158
///

0 commit comments

Comments
 (0)