Skip to content

Commit 977ec0a

Browse files
committed
merge WebAssembly/wasi-messaging
2 parents ff30052 + 55c13e8 commit 977ec0a

13 files changed

+1371
-47
lines changed

.github/workflows/main.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14-
# - uses: WebAssembly/wit-abi-up-to-date@v6
15-
# with:
16-
# wit-abi-tag: wit-abi-0.6.0
14+
- uses: WebAssembly/wit-abi-up-to-date@v17
15+
with:
16+
wit-bindgen: '0.34.0'
17+
worlds: 'imports imports-request-reply messaging-core messaging-request-reply'

.gitignore

-1
This file was deleted.

README.md

+79-23
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,103 @@
22

33
A proposed [WebAssembly System Interface](https://github.com/WebAssembly/WASI) API.
44

5-
### Current Phase
5+
## Table of Contents
6+
7+
- [`wasi-messaging`](#wasi-messaging)
8+
- [Table of Contents](#table-of-contents)
9+
- [Current Phase](#current-phase)
10+
- [Champions](#champions)
11+
- [Phase 4 Advancement Criteria](#phase-4-advancement-criteria)
12+
- [Introduction](#introduction)
13+
- [Goals](#goals)
14+
- [Portability criteria](#portability-criteria)
15+
- [Dev notes](#dev-notes)
616

7-
`wasi-messaging` is currently in [Phase 1](https://github.com/WebAssembly/WASI/blob/main/Proposals.md#phase-1---feature-proposal-cg).
17+
## Current Phase
818

9-
### Champions
19+
`wasi-messaging` is currently in [Phase
20+
1](https://github.com/WebAssembly/WASI/blob/main/Proposals.md#phase-1---feature-proposal-cg).
21+
22+
## Champions
1023

1124
- [Dan Chiarlone](https://github.com/danbugs)
1225
- [David Justice](https://github.com/devigned)
1326
- [Jiaxiao Zhou](https://github.com/Mossaka)
27+
- [Taylor Thomas](https://github.com/thomastaylor312)
1428

15-
### Phase 4 Advancement Criteria
29+
## Phase 4 Advancement Criteria
1630

17-
`wasi-messaging` should have at least two implementations (i.e., from service providers, and or cloud providers), and, at the very minimum, pass the testsuite for Windows, Linux, and MacOS.
31+
For `wasi-messaging` to advance to Phase 4, it must have at least two independent implementations
32+
for open-source message brokers (such as Kafka, NATS, MQTT brokers) and two for cloud service providers
33+
(e.g., Azure Service Bus, AWS SQS).
1834

19-
## Table of Contents
35+
## Introduction
36+
37+
In modern software systems, different components or applications often need to communicate with each other
38+
to exchange information and coordinate their actions. Messaging systems facilitate this communication by
39+
allowing messages to be sent and received between different parts of a system.
40+
41+
However, implementing message-based communication can be challenging. It requires dealing with the details
42+
of message brokers, such as connection management, channel setup, and message serialization. This complexity
43+
can hinder development and lead to inconsistent implementations.
44+
45+
The `wasi-messaging` interface is a purposefully small interface focused purely on message passing. It is
46+
designed to express the bare minimum of receiving a message and sending a message, along with an optional
47+
request/reply interface that allows for message-based APIs and/or RPC.
48+
49+
By providing a standard way to interact with message brokers, the `wasi-messaging` interface aims to simplify
50+
this process, hiding the underlying complexity from the user. This aligns with the broader goals of WASI by
51+
promoting interoperability, modularity, and security in WebAssembly applications.
2052

21-
- [Introduction](#introduction)
22-
- [Goals](#goals)
23-
- [Non-goals](#non-goals)
53+
## Goals
2454

25-
### Introduction
55+
The primary goal of this interface is to focus on message passing. The only guarantee offered is
56+
that publishing a message is handled successfully. No other guarantees are made about the delivery
57+
of the message or being able to ack/nack a message directly. This minimalist approach provides the
58+
most basic foundation of messaging, which can be expanded upon by future interfaces or proposals as
59+
use cases emerge.
2660

27-
The messaging interfaces aim to provide a generic and flexible way for producers and consumers to communicate through message brokers. The `producer` interface allows producers to publish events to a specific channel in a broker, while the `consumer` interface allows consumers to subscribe to a channel and receive events through a push-based mechanism. The handler interface provides an on-receive function that can be used to process received events with full abstraction of the underlying broker implementation.
61+
This simplicity allows:
62+
- **Ease of Integration**: Components can easily implement the message handler in this interface,
63+
with details such as work dispatch and queuing handled behind the scenes, invisible to the business logic.
64+
- **Flexibility**: Anything that can send a message can easily be passed into a queue
65+
(such as a Kafka stream or NATS JetStream) without the knowledge that it is being sent into a queue.
66+
- **Extensibility**: The paradigm can be expanded by future interfaces (like a queue-based work interface) to handle
67+
more complex messaging scenarios. By focusing solely on message passing, the wasi-messaging interface simplifies the
68+
development of interoperable WebAssembly modules that can communicate over various messaging systems without being
69+
tied to any specific implementation.
2870

29-
### Goals
71+
## Portability criteria
3072

31-
The messaging service interfaces aim to address the need for a standard way to handle message-based communication in modern software systems. In complex software systems, different components or even different applications need to communicate with each other to exchange information and coordinate their actions.
73+
The main portability criteria on which this should be judged is whether a component can receive and send a message
74+
from all major messaging systems. This includes:
75+
- Message standards like MQTT and AMQP.
76+
- Specific technologies like NATS and Kafka.
77+
- Cloud provider implementations like Azure Service Bus and AWS SQS.
3278

33-
However, implementing message-based communication can be challenging, as it requires dealing with the details of message brokers, such as connection management, channel setup, and message serialization. The messaging service interfaces aim to simplify this process by providing a standard way to interact with message brokers, hiding the underlying complexity from the user.
79+
This _does not_ mean it implements the full set of features of each of the messaging systems. In fact, it is expected
80+
that most implementations will need to do work to adapt their system to this interface (e.g., in Kafka, you'd have
81+
to mark the message as completed once the call to handle returns).
3482

35-
This standardization can benefit various scenarios, such as microservice architectures, where each microservice can communicate with other microservices using the messaging service interfaces. Similarly, applications that need to handle event-driven or streaming data can benefit from the push-based message delivery mechanism provided by the `consumer` and `handler` interfaces. Overall, the messaging service interfaces aim to make it easier to build complex and scalable software systems by providing a common foundation for message-based communication.
83+
As mentioned above, this should still be completely compatible with any more advanced use cases of the various
84+
message systems. For example, if you have a queue of work that is currently being handled by pre-existing software
85+
outside of Wasm components, a component could use this interface to publish messages that get ingested into this queue.
3686

37-
### Non-goals
87+
Another way to state the portability criteria is that this implementation should not break the possibility of a
88+
component consuming this interface to be integrated with a more advanced messaging use case.
3889

39-
- The messaging service interfaces do not aim to provide advanced features of message brokers, such as broker clustering, message persistence, or guaranteed message delivery. These are implementation-specific details that are not addressed by the interfaces.
40-
- The messaging service interfaces do not aim to provide support for every possible messaging pattern or use case. Instead, they focus on the common use cases of pub-sub and push-based message delivery. Other messaging patterns, such as request-reply or publish-confirm-subscribe, are outside the scope of the interfaces.
41-
- The messaging service interfaces do not aim to provide a specific implementation of a message broker. Instead, they provide a standard way to interact with any message broker that supports the interfaces.
90+
## Dev notes
4291

43-
### API walk-through
92+
To regenerate the `.md` files, run:
93+
```sh
94+
wit-bindgen markdown ./wit/ -w imports --html-in-md
95+
wit-bindgen markdown ./wit/ -w imports-request-reply --html-in-md
96+
wit-bindgen markdown ./wit/ -w messaging-core --html-in-md
97+
wit-bindgen markdown ./wit/ -w messaging-request-reply --html-in-md
98+
```
4499

45-
For a full API walk-through, see [wasi-messaging-demo](https://github.com/danbugs/wasi-messaging-demo).
100+
It would make sense for a lot of these functions to be asynchronous, but that is not currently natively supported in
101+
the component model. Asynchronous support will be added as part of WASI Preview 3. When async support becomes
102+
available, we plan to update the wasi-messaging interface to incorporate asynchronous patterns.
46103

47-
> Note: This README needs to be expanded to cover a number of additional fields suggested in the
48-
[WASI Proposal template](https://github.com/WebAssembly/wasi-proposal-template).
104+
> **Note**: Ensure you have version 0.34.0 of `wit-bindgen` installed to avoid compatibility issues.

0 commit comments

Comments
 (0)