Package io.micronaut.nats
Interface ConsumerRegistry
- All Known Implementing Classes:
NatsConsumerAdvice
public interface ConsumerRegistry
A registry for created Nats consumers.
- Since:
- 3.1.0
- Author:
- jgrimm
-
Method Summary
Modifier and TypeMethodDescription@NonNull io.nats.client.Consumer
getConsumer
(@NonNull String id) Returns the subscription by given id.The IDs of the available consumers.@NonNull Set<io.nats.client.Subscription>
getConsumerSubscription
(@NonNull String id) Returns a managed Consumer's subscriptions.io.nats.client.Subscription
newSubscription
(@NonNull String connectionName, @NonNull String subject, @Nullable String queue) Create a new subscription from the given connection name.io.nats.client.Subscription
newSubscription
(@NonNull String subject, @Nullable String queue) Create a new subscription with the default connection.
-
Method Details
-
getConsumer
Returns the subscription by given id.- Parameters:
id
-String
The id of the listener- Returns:
- The consumer
- Throws:
IllegalArgumentException
- If no listener exists for the given ID
-
getConsumerIds
The IDs of the available consumers.- Returns:
- The consumers
-
getConsumerSubscription
@NonNull @NonNull Set<io.nats.client.Subscription> getConsumerSubscription(@NonNull @NonNull String id) Returns a managed Consumer's subscriptions.- Parameters:
id
- The id of the producer.- Returns:
- The consumer subscription
- Throws:
IllegalArgumentException
- If no consumer exists for the given ID
-
newSubscription
io.nats.client.Subscription newSubscription(@NonNull @NonNull String subject, @Nullable @Nullable String queue) Create a new subscription with the default connection. -
newSubscription
io.nats.client.Subscription newSubscription(@NonNull @NonNull String connectionName, @NonNull @NonNull String subject, @Nullable @Nullable String queue) Create a new subscription from the given connection name.
-