=encoding utf8

=for comment POD_DERIVED_INDEX_GENERATED
The following documentation is automatically generated.  Please do not edit
this file, but rather the original, inline with Myriad::Service
at lib/Myriad/Service.pm
(on the system that originally ran this).
If you do edit this file, and don't want your changes to be removed, make
sure you change the first line.

=cut

=head1 NAME

Myriad::Service - starting point for building microservices

=head1 SYNOPSIS

 package Example::Service;
 use Myriad::Service;

 async method startup {
  $log->infof('Starting %s', __PACKAGE__);
 }

 # Trivial RPC call, provides the `example` method
 async method example : RPC {
  return { ok => 1 };
 }

 # Slightly more useful - return all the original parameters.
 # Due to an unfortunate syntactical choice in core Perl, the
 # whitespace before the (%args) is *mandatory*, without that
 # you're actually passing (%args) to the RPC attribute...
 async method echo : RPC (%args) {
  return \%args;
 }

 # Default internal diagnostics checks are performed automatically,
 # this method is called after the microservice status such as Redis
 # connections, exception status etc. are verified
 async method diagnostics ($level) {
  my ($self, $level) = @_;
  return 'ok';
 }

 1;

=head1 DESCRIPTION

Since this is a framework, by default it attempts to enforce a common standard on all microservice
modules. See L<Myriad::Class> for the details.

The calling package will be marked as an L<Object::Pad> class, providing the
L<Object::Pad/method>, L<Object::Pad/has> and C<async method> keywords.

This also makes available a L<Log::Any> instance in the C<$log> package variable,
and for L<OpenTracing::Any> support you get C<$tracer> as an L<OpenTracing::Tracer>
instance.

=head2 Custom language features

B<You can disable the language behaviour defaults> by specifying C<:custom> as an L</import> parameter:

    package Example::Service;
    use strict;
    use warnings;
    use Myriad::Service qw(:custom);
    use Log::Any qw($log);

This will only apply the L<Myriad::Service::Implementation> parent class, and avoid
any changes to syntax or other features.

=head1 INHERITED METHODS

=over 4

=item L<Object::Pad::UNIVERSAL>

L<BUILDARGS|Object::Pad::UNIVERSAL/BUILDARGS>

=back

=head1 AUTHOR

Deriv Group Services Ltd. C<DERIV@cpan.org>.

See L<Myriad/CONTRIBUTORS> for full details.

=head1 LICENSE

Copyright Deriv Group Services Ltd 2020-2022. Licensed under the same terms as Perl itself.

