Subscribe to peer pubsub snapshots
This commit is contained in:
parent
bc0ba4d169
commit
df70b81a1d
8 changed files with 332 additions and 20 deletions
|
|
@ -320,6 +320,8 @@ pub enum PubsubCommand {
|
|||
},
|
||||
Sub {
|
||||
topic: String,
|
||||
#[arg(long)]
|
||||
node: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -653,7 +655,7 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
|
|||
message,
|
||||
node,
|
||||
},
|
||||
PubsubCommand::Sub { topic } => ControlRequest::PubsubSub { topic },
|
||||
PubsubCommand::Sub { topic, node } => ControlRequest::PubsubSub { topic, node },
|
||||
},
|
||||
Command::Pipe { command } => match command {
|
||||
PipeCommand::Listen { name } => ControlRequest::PipeListen { name },
|
||||
|
|
@ -1477,6 +1479,32 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
|
|||
}
|
||||
println!("note: {note}");
|
||||
}
|
||||
ControlResponse::PubsubRemoteMessages {
|
||||
peer_node_id,
|
||||
peer_agent_id,
|
||||
endpoint_id,
|
||||
topic,
|
||||
messages,
|
||||
allowed,
|
||||
reason,
|
||||
note,
|
||||
} => {
|
||||
if allowed {
|
||||
println!("topic: {topic}");
|
||||
println!("peer: {peer_node_id}");
|
||||
println!("messages: {}", messages.len());
|
||||
for message in messages {
|
||||
println!("{}\t{}", message.published_at.0, message.message);
|
||||
}
|
||||
} else {
|
||||
println!("pubsub subscribe denied by {peer_node_id}");
|
||||
}
|
||||
println!("agent: {peer_agent_id}");
|
||||
println!("endpoint: {endpoint_id}");
|
||||
println!("allowed: {allowed}");
|
||||
println!("reason: {reason}");
|
||||
println!("note: {note}");
|
||||
}
|
||||
ControlResponse::PipeListening { listener } => {
|
||||
println!("listening pipe: {}", listener.name);
|
||||
println!("id: {}", listener.id);
|
||||
|
|
|
|||
Loading…
Reference in a new issue