**refactor(dynamic): introduce NATS protocol emulator with publish/deliver support, enhance endpoint handling, and extend SDK compatibility for Go and Python**

This commit is contained in:
elipeter 2026-05-27 11:47:10 -05:00
parent a55849f1ca
commit a12f7efc3a
7 changed files with 527 additions and 28 deletions

View file

@ -395,6 +395,27 @@ fn message_handler_remaining_brokers_try_http_emulators_before_loopback() {
}
}
#[test]
fn message_handler_nats_go_tries_real_client_before_fallbacks() {
let spec = make_spec_with_adapter(
Lang::Go,
"events",
"OnMessage",
entry_file("nats_go"),
"nats-go",
);
let h = lang::emit(&spec).expect("emit ok");
assert!(h.source.contains("nyxTryRealNats"));
assert!(h.source.contains("github.com/nats-io/nats.go"));
assert!(h.source.contains("nats.Connect"));
assert!(h.source.contains("nc.Subscribe"));
assert!(h.source.contains("nc.Publish"));
assert!(
h.source.find("nyxTryRealNats").unwrap() < h.source.find("nyxFetchHttpBroker").unwrap(),
"nats-go should try the real protocol client before the HTTP fallback"
);
}
// ── Framework-adapter assertions ──────────────────────────────────────────────
fn ts_language_for(lang: Lang) -> tree_sitter::Language {