Register runner when starting script
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
@@ -55,6 +55,8 @@ impl MyceliumClient {
|
||||
"method": method,
|
||||
"params": [ params ]
|
||||
});
|
||||
|
||||
tracing::info!(%req, "jsonrpc");
|
||||
let resp = self.http.post(&self.base_url).json(&req).send().await?;
|
||||
let status = resp.status();
|
||||
let body: Value = resp.json().await?;
|
||||
|
@@ -208,7 +208,7 @@ impl SupervisorClient {
|
||||
.mycelium
|
||||
.push_message(
|
||||
&self.destination,
|
||||
&self.topic,
|
||||
&Self::encode_topic(self.topic.as_bytes()),
|
||||
&payload_b64,
|
||||
Some(reply_timeout_secs),
|
||||
)
|
||||
|
@@ -522,10 +522,7 @@ pub fn start_inbound_listener(
|
||||
|
||||
loop {
|
||||
// Poll for inbound supervisor messages on the configured topic
|
||||
match mycelium
|
||||
.pop_message(Some(false), Some(20), Some(cfg.topic.as_str()))
|
||||
.await
|
||||
{
|
||||
match mycelium.pop_message(Some(false), Some(20), None).await {
|
||||
Ok(Some(inb)) => {
|
||||
// Expect InboundMessage with base64 "payload"
|
||||
let Some(payload_b64) = inb.get("payload").and_then(|v| v.as_str()) else {
|
||||
@@ -545,6 +542,10 @@ pub fn start_inbound_listener(
|
||||
.await;
|
||||
continue;
|
||||
};
|
||||
tracing::info!(
|
||||
raw = %String::from_utf8_lossy(&raw),
|
||||
"Read raw messge from mycelium"
|
||||
);
|
||||
let Ok(rpc): Result<Value, _> = serde_json::from_slice(&raw) else {
|
||||
// Invalid JSON payload
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user