Giter VIP home page Giter VIP logo

Comments (5)

mnapoli avatar mnapoli commented on May 29, 2024

Hi, $_SERVER['LAMBDA_INVOCATION_CONTEXT'] is only available when running with the "FPM" layer (in HTTP context). It won't work for queues.

One reason is that the same PHP process can be kept alive to handle multiple SQS jobs (for example), so we cannot set the values in an environment variable.

One way would be for you to write a custom SqsHandler class, but then you loose all the features of Laravel Queues :/

Could you explain what information you want to access in the invocation context?

Also I wonder if it's possible to store the context somewhere in the Laravel job 🤔

from laravel-bridge.

matthewsuan avatar matthewsuan commented on May 29, 2024

@mnapoli I wanted to access the deadlineMs value so I can pre-emptively do something before a lambda timeout occurs.

Do you think we can add support to this?

from laravel-bridge.

mnapoli avatar mnapoli commented on May 29, 2024

We could, but we need to figure out how and where's the best place to put this information. Any idea?

from laravel-bridge.

matthewsuan avatar matthewsuan commented on May 29, 2024

Inside LaravelSqsHandler.handleSqs we have access to Context object but then it was never used. I think we can set $_SERVER['LAMBDA_INVOCATION_CONTEXT'] from there same way we did with the FpmHandler?

Or we could also push the context object down further to SqsJob as object props.

I am very willing to open up a PR for this but just wanted to be sure this is in line with the general direction of Bref.

from laravel-bridge.

mnapoli avatar mnapoli commented on May 29, 2024

$_SERVER won't work because of the reasons listed here: #78 (comment)

Adding that in SqsJob could be a better option indeed, but is there a good place for it that doesn't pollute the job's data?

from laravel-bridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.