Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(examples): Adds http-keyvalue-bus component example #160

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ericgregory
Copy link
Contributor

Adds Key-value counter with wasmCloud bus example to demonstrate link definition via wasmcloud:bus.

@ericgregory ericgregory requested a review from a team as a code owner January 13, 2025 16:34
Signed-off-by: Eric Gregory <[email protected]>
@ericgregory
Copy link
Contributor Author

Streamlined in several ways to improve clarity and reduce lines of code:

  • Switched to parameters for routing and user-supplied values
  • Simplified to a single function for kv handling
  • Condensed CallTargetInterface steps

func kvHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
logger := wasilog.ContextLogger("kvHandler")

// Return if the kv parameter doesn't specify one of our KV providers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO: This is not wrong/bad but think it was based on our Rust implementation and would be simpler to provide 2 wadm yamls instead of runtime linking. one for redis and one for nats, both going thru default link.

Runtime linking is nuanced and we don't use it very often. codesearch
With TinyGo .33 and large wasm-collider https://github.com/lxfontes/lwc/blob/main/probe/main.go#L35 we saw situations where repointing the link locked up the component. slightly different situation due to long tail-calls but still strange.

It's also one of those 🤔 features that might change/go-away as wasip3 comes along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants