mirror of
https://github.com/Lore09/Tesi-Magistrale.git
synced 2025-12-19 12:24:31 +00:00
kafka provider template
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package wasi:logging@0.1.0-draft;
|
||||
|
||||
/// WASI Logging is a logging API intended to let users emit log messages with
|
||||
/// simple priority levels and context values.
|
||||
interface logging {
|
||||
/// A log level, describing a kind of message.
|
||||
enum level {
|
||||
/// Describes messages about the values of variables and the flow of
|
||||
/// control within a program.
|
||||
trace,
|
||||
/// Describes messages likely to be of interest to someone debugging a
|
||||
/// program.
|
||||
debug,
|
||||
/// Describes messages likely to be of interest to someone monitoring a
|
||||
/// program.
|
||||
info,
|
||||
/// Describes messages indicating hazardous situations.
|
||||
warn,
|
||||
/// Describes messages indicating serious errors.
|
||||
error,
|
||||
/// Describes messages indicating fatal errors.
|
||||
critical,
|
||||
}
|
||||
|
||||
/// Emit a log message.
|
||||
///
|
||||
/// A log message has a `level` describing what kind of message is being
|
||||
/// sent, a context, which is an uninterpreted string meant to help
|
||||
/// consumers group similar messages, and a string containing the message
|
||||
/// text.
|
||||
log: func(level: level, context: string, message: string);
|
||||
}
|
||||
|
||||
world imports {
|
||||
import logging;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package wasmcloud:messaging@0.2.0;
|
||||
|
||||
/// Types common to message broker interactions
|
||||
interface types {
|
||||
/// A message sent to or received from a broker
|
||||
record broker-message {
|
||||
subject: string,
|
||||
body: list<u8>,
|
||||
reply-to: option<string>,
|
||||
}
|
||||
}
|
||||
|
||||
interface handler {
|
||||
use types.{broker-message};
|
||||
|
||||
/// Callback handled to invoke a function when a message is received from a subscription
|
||||
handle-message: func(msg: broker-message) -> result<_, string>;
|
||||
}
|
||||
|
||||
interface consumer {
|
||||
use types.{broker-message};
|
||||
|
||||
/// Perform a request operation on a subject
|
||||
request: func(subject: string, body: list<u8>, timeout-ms: u32) -> result<broker-message, string>;
|
||||
|
||||
/// Publish a message to a subject without awaiting a response
|
||||
publish: func(msg: broker-message) -> result<_, string>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package wasmcloud:hello;
|
||||
|
||||
world hello {
|
||||
import wasi:logging/logging@0.1.0-draft;
|
||||
import wasmcloud:messaging/consumer@0.2.0;
|
||||
|
||||
export wasmcloud:messaging/handler@0.2.0;
|
||||
}
|
||||
Reference in New Issue
Block a user