Zum Inhalt

AntonObject: Events, Jobs & Listeners

1. Event → Listener → Job Kette

Event Listener Queue? Dispatched Jobs
ObjectMoved ObjectSetPath async (ShouldQueue) UpdatePaths
ObjectChanged ObjectUpdateParents sync UpdateDates + RefreshFulltext
MediumAdded MediumIdentifyAndConvert async (ShouldQueue) Format-Identifikation, Cloud-Copy, Conversions, RefreshFulltext
ImportFinished ImportFinished sync Kette: UpdatePathsProcessMediaFilesProcessMediaIdentificationBatchUpdateDatesRefreshFulltext
LoanedObject ObjectUpdatesLoansOnDescendants async (ShouldQueue) UpdateLoans

2. Operationen auf AntonObject → Was passiert?

Operation Model-Hook Events (wenn $suppressDomainEvents = false) Zusätzliche Aktionen
create (Einzelobjekt) savingcreated ObjectMovedUpdatePaths fonds_id setzen
ObjectChangedUpdateDates + RefreshFulltext Cache flush, updateHasChildren auf Parent
create_bulk savingcreated (pro Objekt) unterdrückt ($suppressDomainEvents = true) Nach Schleife 1× manuell: UpdatePaths, UpdateDates, RefreshFulltext
update updatingupdated ObjectChangedUpdateDates + RefreshFulltext version++, real_depth, uuid
update (mit dirty private) updating UpdateDescendantsPrivate → alle Nachkommen + Fulltext
update (mit dirty release_year) updating UpdateDescendantsReleaseDate → alle Nachkommen
update (mit dirty status_of_description_id auf Fonds) updating UpdateDescendantsStatusOfDescription → alle Nachkommen
move (behind/infrontof/into) savingsaved (intern) unterdrückt während Move; danach 1× ObjectMovedUpdatePaths reorderChildren, updateHasChildren, ggf. Move-Protokoll (wenn setting('record_move_events'))
delete (moveToTrash) deletingdeleted Notes löschen, Kinder rekursiv in Papierkorb, Cache flush
addAntonMedium MediumAdded → Format-ID, Conversions, RefreshFulltext Nur wenn $fire_medium_added_event = true

3. Jobs im Detail

Job Timeout Retries Was macht er?
UpdatePaths 3600s Aktualisiert das path[]-Attribut für Objekte und ihre Nachkommen
UpdateDates 7200s 3× (60s Backoff) Aggregiert Entstehungsdaten (artisan anton:update-dates)
RefreshFulltext 14400s 3× (60s Backoff) Extrahiert PDF-Text, aktualisiert MySQL-Fulltext-Index (artisan anton:update-fulltext)
UpdateDescendantsPrivate Setzt private auf allen Nachkommen + Fulltext-Update in 1000er-Chunks
UpdateDescendantsStatusOfDescription Setzt status_of_description_id auf allen Nachkommen
UpdateDescendantsReleaseDate Aktualisiert release_year / release_year_calculated auf Nachkommen
UpdateLoans Aktualisiert Ausleih-Status auf Nachkommen

4. Performance-Hinweis: Sync-Queue

Mit QUEUE_DRIVER=sync laufen alle Jobs synchron. Das bedeutet:

  • Ein einzelnes create feuert ObjectMoved + ObjectChanged → löst synchron UpdatePaths + UpdateDates + RefreshFulltext aus — 3 schwere Prozesse pro Objekt
  • create_bulk unterdrückt das und macht es 1× am Ende für alle IDs
  • move unterdrückt Events während der Operation, feuert ObjectMoved 1× am Ende (kein ObjectChanged, daher kein UpdateDates/RefreshFulltext beim Move)

5. Relevante Dateien

Datei Beschreibung
app/Models/AntonObject.php Model-Events (booted()), move(), $suppressDomainEvents
app/Events/ObjectMoved.php Event-Klasse für Verschiebungen
app/Events/ObjectChanged.php Event-Klasse für Änderungen (inkl. Create)
app/Events/MediumAdded.php Event-Klasse für neue Medien
app/Events/ImportFinished.php Event-Klasse für abgeschlossene Importe
app/Listeners/ObjectSetPath.php Listener: ObjectMovedUpdatePaths
app/Listeners/ObjectUpdateParents.php Listener: ObjectChangedUpdateDates + RefreshFulltext
app/Listeners/MediumIdentifyAndConvert.php Listener: MediumAdded → Identifikation, Conversions
app/Listeners/ImportFinished.php Listener: ImportFinished → Job-Kette
app/Jobs/UpdatePaths.php Job: Pfade aktualisieren
app/Jobs/UpdateDates.php Job: Daten aggregieren
app/Jobs/RefreshFulltext.php Job: Fulltext-Index aktualisieren
app/Providers/EventServiceProvider.php Event-Listener-Mapping
app/Http/Controllers/ObjectsController.php create_bulk() mit Event-Unterdrückung