adobe / adobe/aio-lib-java

`aem` `aio-aem-events-osgi-mapping` : Cannot make custom Event Handler Type

Ouverte
#123 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
7
Forks
22
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### Question
How to make a custom Event Handler that will be registered and has an additional custom field in the event's request payload?

### Expected Behaviour
We want a custom Page Publish event which has custom fields in the event's request payload.

1. Create **com.adobe.aio.aem.event.osgimapping.internal.OsgiEventMappingSupplierImpl-custom.cfg.json** file in config.author directory containing the following:

{
"aio.event.code": "custom_published",
"aio.event.label": "Custom Page Published",
"aio.event.description": "Custom Page Published Event",
"aio.xdm.event.type": "com.adobe.xdm.event.AemPagePublishedEvent",
"osgi.event.handler.type": "com.proj.core.eventhandler.CustomHandler",
"osgi.topic": "com/day/cq/replication",
"osgi.filter": "(&(type=ACTIVATE)(!(event.application=*)))",
"osgi.jcr.path.filter": "/content/"
}

2. CustomHandler inherits from one of the abstract classes like ReplicationEventHandler (and puts CustomPage inheriting from Page) or something else which will give access to add custom fields to the event's request payload.
3. Handler is registered and the event's request payload has defined by CustomHandler additional fields.

### Actual Behaviour
1) When tried to inherit from **ReplicationEventHandler\** (where CustomPage inherits from com.adobe.xdm.content.Page) and **AdobeIoEventHandler\**, there was a problem, because **List> getXdmObjectActorDateTriples(Event event, ResourceResolverWrapper resourceResolverWrapper)** is package-private and there cannot be a class created outside this package and implements this method.
2) When inheriting eg. from **PageReplicationEventHandler** custom handler does not work and logs say:

com.adobe.aio.aem.event.osgimapping.internal.OsgiEventMappingRegistrationServiceImpl Adobe I/O Events' OSGI Handler Registration failed: `Unreferenced/unimplemented OSGI event Handler value: com.proj.core.eventhandler.CustomHandler
com.adobe.aio.exception.AIOException: Unreferenced/unimplemented OSGI event Handler value: com.proj.core.eventhandler.CustomHandler

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par lire OsgiEventMappingSupplierImpl et OsgiEventMappingRegistrationServiceImpl, puis suivez la manière dont PageReplicationEventHandler et ReplicationEventHandler sont reconnus. Examinez la méthode package-private getXdmObjectActorDateTriples et l’erreur de handler non référencé. C’est terminé lorsqu’un handler personnalisé peut s’enregistrer à partir du mapping présenté et ajouter des champs au payload de la requête d’événement.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
backend
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.