src/MessageConsumer.php
/**
     * Higher order function that consumes the message.
     *
     * @param ActionInterface $action  Action to be executed
     * @param array           $headers Attributes of the message headers
     * @param array           $body    Attributes of the message body
     *
     * @return callable
     */
Higher order function that consumes the message.
@param ActionInterface $action  Action to be executed
@param array           $headers Attributes of the message headers
@param array           $body    Attributes of the message body

@return callable
Higher order function that consumes the message . @param ActionInterface $action Action to be executed @param array $headers Attributes of the message headers @param array $body Attributes of the message body @return callable
public static function consume(ActionInterface $action, array $headers, array $body): callable
    {
        return function () use ($action, $headers, $body) {
            $reflect = new ReflectionClass($action);
            $carrier = ($headers['carrier'] ?? null);
            $span = TracerCapsule::extractCarrier($reflect->getShortName(), $carrier);
            self::log('INFO', $reflect->getShortName(), 'STARTED', $headers, $body);
            $action->handle($headers, $body);
            self::log('INFO', $reflect->getShortName(), 'COMPLETED', $headers, $body);
            $span->finish();
        };
    }
public static function consume ( ActionInterface $ action , array $ headers , array $ body ) : callable { return function ( ) use ( $ action , $ headers , $ body ) { $ reflect = new ReflectionClass ( $ action ) ; $ carrier = ( $ headers [ 'carrier' ] ?? null ) ; $ span = TracerCapsule :: extractCarrier ( $ reflect -> getShortName ( ) , $ carrier ) ; self :: log ( 'INFO' , $ reflect -> getShortName ( ) , 'STARTED' , $ headers , $ body ) ; $ action -> handle ( $ headers , $ body ) ; self :: log ( 'INFO' , $ reflect -> getShortName ( ) , 'COMPLETED' , $ headers , $ body ) ; $ span -> finish ( ) ; } ; }
Higher order function that consumes the message.
Higher order function that consumes the message .