简体   繁体   中英

Can I use Laravel 4 Queues to process print-jobs on Windows?

This question is a continuation to questions I have asked previously with regard to printing documents via Word on Windows from Laravel.

My issue was that I did not want to launch the necessary printing tasks within a POST request as this would show no feedback of the task, and would only respond once the task completed.

For example, if I called the POST /pledge/submit route, I would not want to call the necessary tasks for printing within that same request for the route.

Now, I see that Laravel 4 has a facility called Queues , which (I assume) would allow me to background process these tasks, and postpone them until a later time.

Having read through the documentation, I see that it supports four different drivers, one of which is sync .

Question: Can I use this driver to create new print jobs in the queue, and have them executed by an external application (such as one created in Delphi)? The app would periodically check to see if there are items in the queue, and then execute them (and, of course, remove them).

I am simply trying to find the best way to publish documents without the end-user having to wait for the page to respond whilst printing is underway. Further, I am new to queues in PHP, and am not familiar with how they work (in so far as a detailed process flow). If someone could also explain this, I would appreciate it very much.

The queue system wouldnt work for your Delphi program out of the box - you would need to make some modifications.

Instead - the easiest way would be to make your own 'table' in your database, called 'pending_print_jobs'.

When the user wants to print job 'x' - you get PHP to save the print job in the 'pending_print_jobs' table with all the details you need (such as file to be printed, the user who did it etc etc).

Then you would get your external application (ie your Delphi program) to periodically check the 'pending_print_jobs' table in your database. If it finds any records - it can action them - and print the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM