You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an example to define one class DataflowType:
176
170
@@ -230,15 +224,16 @@ class MyFirstDataflowType extends AbstractDataflowType
230
224
231
225
Dataflow types must be tagged with `coderhapsodie.dataflow.type`.
232
226
233
-
If you're using Symfony auto-configuration for your services, this tag will be automatically added to all services implementing `DataflowTypeInterface`.
227
+
If you're using Symfony auto-configuration for your services, this tag will be automatically added to all services
228
+
implementing `DataflowTypeInterface`.
234
229
235
230
Otherwise, manually add the tag `coderhapsodie.dataflow.type` in your dataflow type service configuration:
@@ -264,11 +259,14 @@ class MyFirstDataflowType extends AbstractDataflowType
264
259
}
265
260
```
266
261
267
-
With this configuration, the option `fileName` is required. For an advanced usage of the option resolver, read the [Symfony documentation](https://symfony.com/doc/current/components/options_resolver.html).
262
+
With this configuration, the option `fileName` is required. For an advanced usage of the option resolver, read
263
+
the [Symfony documentation](https://symfony.com/doc/current/components/options_resolver.html).
268
264
269
265
For asynchronous management, `AbstractDataflowType` come with two default options :
266
+
270
267
- loopInterval : default to 0. Update this interval if you wish customise the `tick` loop duration.
271
-
- emitInterval : default to 0. Update this interval to have a control when reader must emit new data in the flow pipeline.
268
+
- emitInterval : default to 0. Update this interval to have a control when reader must emit new data in the flow
269
+
pipeline.
272
270
273
271
### Logging
274
272
@@ -292,14 +290,15 @@ class MyDataflowType extends AbstractDataflowType
292
290
}
293
291
```
294
292
295
-
When using the `code-rhapsodie:dataflow:run-pending` command, this logger will also be used to save the log in the corresponding job in the database.
293
+
When using the `code-rhapsodie:dataflow:run-pending` command, this logger will also be used to save the log in the
294
+
corresponding job in the database.
296
295
297
296
### Check if your DataflowType is ready
298
297
299
298
Execute this command to check if your DataflowType is correctly registered:
@@ -316,10 +315,10 @@ Symfony Container Public and Private Services Tagged with "coderhapsodie.dataflo
316
315
317
316
```
318
317
319
-
320
318
### Readers
321
319
322
-
*Readers* provide the dataflow with elements to import / export. Usually, elements are read from an external resource (file, database, webservice, etc).
320
+
*Readers* provide the dataflow with elements to import / export. Usually, elements are read from an external resource (
321
+
file, database, webservice, etc).
323
322
324
323
A *Reader* can be any `iterable`.
325
324
@@ -357,15 +356,16 @@ You can set up this reader as follows:
357
356
$builder->setReader(($this->myReader)())
358
357
```
359
358
360
-
361
359
### Steps
362
360
363
361
*Steps* are operations performed on the elements before they are handled by the *Writers*. Usually, steps are either:
362
+
364
363
- converters, that alter the element
365
364
- filters, that conditionally prevent further operations on the element
366
365
- generators, that can include asynchronous operations
367
366
368
367
A *Step* can be any callable, taking the element as its argument, and returning either:
368
+
369
369
- the element, possibly altered
370
370
- `false`, if no further operations should be performed on this element
371
371
@@ -409,7 +409,8 @@ Note : you can ensure writing order for asynchronous operations if all steps are
409
409
*Writers* perform the actual import / export operations.
410
410
411
411
A *Writer* must implement `CodeRhapsodie\DataflowBundle\DataflowType\Writer\WriterInterface`.
412
-
As this interface is not compatible with `Port\Writer`, the adapter `CodeRhapsodie\DataflowBundle\DataflowType\Writer\PortWriterAdapter` is provided.
412
+
As this interface is not compatible with `Port\Writer`, the
413
+
adapter `CodeRhapsodie\DataflowBundle\DataflowType\Writer\PortWriterAdapter` is provided.
413
414
414
415
This example show how to use the predefined PhpPort Writer :
415
416
@@ -460,7 +461,9 @@ class FileWriter implements WriterInterface
460
461
461
462
#### CollectionWriter
462
463
463
-
If you want to write multiple items from a single item read, you can use the generic `CollectionWriter`. This writer will iterate over any `iterable` it receives, and pass each item from that collection to your own writer that handles single items.
464
+
If you want to write multiple items from a single item read, you can use the generic `CollectionWriter`. This writer
465
+
will iterate over any `iterable` it receives, and pass each item from that collection to your own writer that handles
If you want to call different writers depending on what item is read, you can use the generic `DelegatorWriter`.
472
475
473
-
As an example, let's suppose our items are arrays with the first entry being either `product` or `order`. We want to use a different writer based on that value.
476
+
As an example, let's suppose our items are arrays with the first entry being either `product` or `order`. We want to use
477
+
a different writer based on that value.
474
478
475
-
First, create your writers implementing `DelegateWriterInterface` (this interface extends `WriterInterface` so your writers can still be used without the `DelegatorWriter`).
479
+
First, create your writers implementing `DelegateWriterInterface` (this interface extends `WriterInterface` so your
480
+
writers can still be used without the `DelegatorWriter`).
476
481
477
482
```php
478
483
<?php
@@ -545,7 +550,8 @@ Then, configure your `DelegatorWriter` and add it to your dataflow type.
545
550
}
546
551
```
547
552
548
-
During execution, the `DelegatorWriter` will simply pass each item received to its first delegate (in the order those were added) that supports it. If no delegate supports an item, an exception will be thrown.
553
+
During execution, the `DelegatorWriter` will simply pass each item received to its first delegate (in the order those
554
+
were added) that supports it. If no delegate supports an item, an exception will be thrown.
549
555
550
556
## Queue
551
557
@@ -563,7 +569,8 @@ Several commands are provided to manage schedules and run jobs.
563
569
564
570
`code-rhapsodie:dataflow:run-pending`Executes job in the queue according to their schedule.
565
571
566
-
When messenger mode is enabled, jobs will still be created according to their schedule, but execution will be handled by the messenger component instead.
572
+
When messenger mode is enabled, jobs will still be created according to their schedule, but execution will be handled by
573
+
the messenger component instead.
567
574
568
575
`code-rhapsodie:dataflow:schedule:list`Display the list of dataflows scheduled.
0 commit comments