I use playframework, and I am struggling with a concurrent task:
I have a module in which methods use Request.current (module FbGraph). I need to access these methods from Job, but Job runs on another thread. In this thread, Request.current returns null, and because of this, the module does not work.
Can I pass the value of the current request to Job? Will Request.current return the same value as in the main thread? Or do I need to fix something in the module, and keep the current request value within it?
You need to explicitly pass the request object to your Job class. Suppose you have the following job class:
And use your MyJob:
For other modules that use Request.current() you will need to either check if you can pass request object to that module, or use that module in your controller action thread.