For the complete documentation index, see llms.txt. This page is also available as Markdown.

Additional Scenarios

Advanced Interceptor scenarios and configurations in Ecotone

Access attribute from interceptor

We may access attribute from the intercepted endpoint in order to perform specific action

#[\Attribute]
class Cache 
{
    public string $cacheKey;
    public int $timeToLive;
    
    public function __construct(string $cacheKey, int $timeToLive)
    {
        $this->cacheKey = $cacheKey;
        $this->timeToLive = $timeToLive;
    }
}

then we would have an Message Endpoint using this Attribute:

class ProductsService
{
   #[QueryHandler]
   #[Cache("hotestProducts", 120)]
   public function getHotestProducts(GetOrderDetailsQuery $query) : array
   {
      return ["orderId" => $query->getOrderId()]
   }
}  

and it can be used in the intereceptors by type hinting given parameter:

Last updated

Was this helpful?