T
T
Tarrissarh2018-12-29 13:57:18
Laravel
Tarrissarh, 2018-12-29 13:57:18

How to properly use transactions in queues?

There is some functionality for importing data from xml using Queues:

ImportChain::withChain([
                new Import1(),
                new Import2(),
                new Import3(),
            ])->dispatch();

In the Import {1-3} works in the handle, the models are called, in which files are read and data is written to the database.
How to correctly make a transaction for all imports?
Those. everything that will be executed in Import {1-3} went as a single transaction?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vism, 2018-12-29
@vism

do everything in 1 call.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question