| 1 | package Net::NATS::Subscription; | ||
| 2 | |||
| 3 | use Class::XSAccessor { | ||
| 4 | constructors => [ 'new' ], | ||
| 5 | accessors => [ | ||
| 6 | 'subject', | ||
| 7 | 'group', | ||
| 8 | 'sid', | ||
| 9 | 'callback', | ||
| 10 | 'client', | ||
| 11 | ], | ||
| 12 | lvalue_accessors => [ | ||
| 13 | 'message_count', | ||
| 14 | 'max_msgs', | ||
| 15 | ], | ||
| 16 | defined_predicates => { | ||
| 17 | defined_max => 'max_msgs', | ||
| 18 | }, | ||
| 19 | }; | ||
| 20 | |||
| 21 | sub auto_unsubscribe { | ||
| 22 | my $self = shift; | ||
| 23 | my ($max_msgs) = @_; | ||
| 24 | $self->client->unsubscribe($self, $max_msgs); | ||
| 25 | } | ||
| 26 | |||
| 27 | sub unsubscribe { | ||
| 28 | my $self = shift; | ||
| 29 | $self->client->unsubscribe($self); | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; |