adobe / adobe/aio-lib-java

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

オープン
#123 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
7
フォーク
22
PR マージ指標
30日以内にマージされた PR はありません

説明

### 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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず OsgiEventMappingSupplierImpl と OsgiEventMappingRegistrationServiceImpl を読み、次に PageReplicationEventHandler と ReplicationEventHandler がどのように認識されるかを追ってください。package-private の getXdmObjectActorDateTriples メソッドと、参照されていないハンドラーのエラーを確認してください。示されている mapping からカスタムハンドラーを登録し、イベントリクエストの payload にフィールドを追加できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。