Skip to content

Commit

Permalink
Add convenient method for subscribing to stream requests
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed May 10, 2024
1 parent aa5fa80 commit e127680
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/subspace-farmer/src/cluster/nats_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,20 @@ impl NatsClient {
.await
}

/// Simple subscription that will produce decoded stream requests, while skipping messages that
/// fail to decode
pub async fn subscribe_to_stream_requests<Request>(
&self,
instance: Option<&str>,
queue_group: Option<String>,
) -> Result<SubscriberWrapper<StreamRequest<Request>>, SubscribeError>
where
Request: GenericStreamRequest,
{
self.simple_subscribe(Request::SUBJECT, instance, queue_group)
.await
}

/// Simple subscription that will produce decoded notifications, while skipping messages that
/// fail to decode
pub async fn subscribe_to_notifications<Notification>(
Expand Down

0 comments on commit e127680

Please sign in to comment.