| 1 | package Kafka::Message; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Kafka::Message - Interface to the Kafka message properties. | ||
| 6 | |||
| 7 | =head1 VERSION | ||
| 8 | |||
| 9 | This documentation refers to C<Kafka::Message> version 1.07 . | ||
| 10 | |||
| 11 | =cut | ||
| 12 | |||
| 13 | |||
| 14 | |||
| 15 | use 5.010; | ||
| 16 | use strict; | ||
| 17 | use warnings; | ||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | our $VERSION = '1.07'; | ||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | our @_standard_fields = qw( | ||
| 28 | Attributes | ||
| 29 | Timestamp | ||
| 30 | error | ||
| 31 | HighwaterMarkOffset | ||
| 32 | key | ||
| 33 | MagicByte | ||
| 34 | next_offset | ||
| 35 | payload | ||
| 36 | offset | ||
| 37 | valid | ||
| 38 | ); | ||
| 39 | |||
| 40 | #-- constructor ---------------------------------------------------------------- | ||
| 41 | |||
| 42 | sub new { | ||
| 43 | my ( $class, $self ) = @_; | ||
| 44 | |||
| 45 | bless $self, $class; | ||
| 46 | |||
| 47 | return $self; | ||
| 48 | } | ||
| 49 | |||
| 50 | #-- public attributes ---------------------------------------------------------- | ||
| 51 | |||
| 52 | { | ||
| 53 | no strict 'refs'; ## no critic | ||
| 54 | |||
| 55 | # getters | ||
| 56 | foreach my $method ( @_standard_fields ) | ||
| 57 | { | ||
| 58 | *{ __PACKAGE__.'::'.$method } = sub { | ||
| 59 | my ( $self ) = @_; | ||
| 60 | return $self->{ $method }; | ||
| 61 | }; | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | #-- public methods ------------------------------------------------------------- | ||
| 66 | |||
| 67 | #-- private attributes --------------------------------------------------------- | ||
| 68 | |||
| 69 | #-- private methods ------------------------------------------------------------ | ||
| 70 | |||
| 71 | |||
| 72 | |||
| 73 | 1; | ||
| 74 | |||
| 75 | __END__ |