File tree 1 file changed +19
-4
lines changed 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -282,23 +282,38 @@ do is to write your own CSV receiver::
282
282
$this->filePath = $filePath;
283
283
}
284
284
285
- public function receive(callable $handler ): void
285
+ public function get( ): void
286
286
{
287
287
$ordersFromCsv = $this->serializer->deserialize(file_get_contents($this->filePath), 'csv');
288
288
289
289
foreach ($ordersFromCsv as $orderFromCsv) {
290
290
$order = new NewOrder($orderFromCsv['id'], $orderFromCsv['account_id'], $orderFromCsv['amount']);
291
291
292
- $handler(new Envelope($order));
292
+ $envelope = new Envelope($order);
293
+
294
+ $handler($envelope);
293
295
}
296
+
297
+ return [$envelope];
294
298
}
295
299
296
- public function stop( ): void
300
+ public function ack(Envelope $envelope ): void
297
301
{
298
- // noop
302
+ // Add information about the handled message
303
+ }
304
+
305
+ public function reject(Envelope $envelope): void
306
+ {
307
+ // Reject the message if needed
299
308
}
300
309
}
301
310
311
+ .. versionadded :: 4.3
312
+
313
+ In Symfony 4.3, the ``ReceiverInterface `` has changed its methods as shown
314
+ in the example above. You may need to update your code if you used this
315
+ interface in previous Symfony versions.
316
+
302
317
Receiver and Sender on the same Bus
303
318
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
304
319
<
2C20
stop offset="1" stop-color="#eee">
You can’t perform that action at this time.
0 commit comments