wasmCloud Messaging Interface
This is the interface for the wasmcloud:messaging
contract. This contract is a very simple abstraction over the concept of a message broker. This contract does not have controls or knobs or settings for things like delivery guarantees (e.g. "at most once" vs "at least once"), persistence of messages, etc. Such details are the responsibility of individual providers.
Capability Provider Implementations
The following is a list of implementations of the wasmcloud:messaging
contract. Feel free to submit a PR adding your implementation if you have a community/open source version.
Name | Vendor | Description |
---|---|---|
NATS | wasmCloud | wasmCloud Messaging Provider for the NATS broker |
Example Usage
🦀 Rust
Implementing the Messaging.HandleMessage
operation
use *;
use info;
use ;
Sending a message via a wasmcloud:messaging
provider without expecting a reply
use *;
use ;
async
Sending a message via a wasmcloud:messaging
provider, waiting one second for a reply
use *;
use ;
async
🐭 Golang
Implementing the Messaging.HandleMessage
operation
import (
"github.com/wasmcloud/actor-tinygo"
logging "github.com/wasmcloud/interfaces/logging/tinygo"
messaging "github.com/wasmcloud/interfaces/messaging/tinygo"
)
type Actor struct
func main()
func (ctx *actor.Context, msg messaging.SubMessage) error
Sending a message via a wasmcloud:messaging
provider without expecting a reply
import (
"github.com/wasmcloud/actor-tinygo"
messaging "github.com/wasmcloud/interfaces/messaging/tinygo"
)
func PublishMessage(ctx *actor.Context, subj string, body []byte) error
Sending a message via a wasmcloud:messaging
provider, waiting one second for a reply
import (
"github.com/wasmcloud/actor-tinygo"
logging "github.com/wasmcloud/interfaces/logging/tinygo"
messaging "github.com/wasmcloud/interfaces/messaging/tinygo"
)
var logger *logging.NewProviderLogging()
func MessageRequest(ctx *actor.Context, subj string, body []byte) error