capsulenats

package
v0.0.0-...-d76bbf2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 11 Imported by: 0

README

nats/listen.go

This execution mode (nats) "transforms" capsule in a NATS subscriber.

capsule \
   -wasm=../wasm_modules/capsule-nats-subscriber/hello.wasm \
   -mode=nats \
   -natssrv=nats.devsecops.fun:4222 \
   -subject=ping
  • capsule is listening on the subject "ping" (like a MQTT topic)
  • every time a message is posted on "ping" capsule will run a wasm module and call the "Handle" function of the module

The Listen function is called by ../../main.go:

  • it stores/saves the subject string (then it will be available for the wasm module thanks to a host function)
  • it creates the NATS connection
  • it subscribes to the subject

helpers to create + get the connection and to store the topic are located in commons/nats.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen(natssrv string, subject string, wasmFile []byte)

func StoreExitError

func StoreExitError(from string, err error, exitCode int, wasmFile []byte)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL