adobe / adobe/aio-lib-java

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

Đang mở
#123 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
7
Fork
22
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách đọc OsgiEventMappingSupplierImpl và OsgiEventMappingRegistrationServiceImpl, sau đó theo dõi cách PageReplicationEventHandler và ReplicationEventHandler được nhận diện. Xem xét phương thức package-private getXdmObjectActorDateTriples và lỗi handler không được tham chiếu. Hoàn tất có nghĩa là một handler tùy chỉnh có thể đăng ký từ mapping được hiển thị và thêm các trường vào payload yêu cầu sự kiện.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
backend
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.