NAME

Net::Async::NATS::Subscription - Represents a NATS subscription

VERSION

version 0.002

SYNOPSIS

my $sub = await $nats->subscribe('foo.>', sub {
    my ($subject, $payload, $reply_to) = @_;
    # handle message
});

say $sub->sid;      # subscription ID
say $sub->subject;  # subscribed subject

await $nats->unsubscribe($sub);

DESCRIPTION

Lightweight object representing a single NATS subscription. Created by "subscribe" in Net::Async::NATS and passed to "unsubscribe" in Net::Async::NATS.

sid

The unique subscription identifier (integer).

subject

The subject this subscription listens on.

queue

Optional queue group name for load-balanced delivery.

callback

The coderef invoked for each received message. Signature: ($subject, $payload, $reply_to).

max_msgs

If set, the subscription auto-unsubscribes after receiving this many messages.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-net-async-nats/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.