event-migration
БесплатноБез исполняемых скриптовНе проверенAEM Cloud Service expert skill for OSGi Event Admin handlers (non-resource events). Covers migration of javax.jcr.observation.EventListener (residual…
от adobe★ 342 звезды на GitHubОб этом скилле
Event Migration — AEM as a Cloud Service
Overview
org.osgi.service.event.EventHandler is the API for reacting to non-resource OSGi Event Admin events on AEM CS — replication events (com.day.cq.replication.ReplicationEvent.EVENT_TOPIC), workflow events (com/adobe/granite/workflow/*), and custom inter-bundle event topics. The handler runs on a shared OSGi event thread and must stay lightweight — all business logic must be offloaded to a Sling Job via JobManager.addJob().
Three CS-specific constraints every event handler must satisfy:
| Constraint | Why |
|---|---|
No ResourceResolver / Session / JCR ops inside handleEvent() |
Blocks the shared OSGi event-admin thread; can delay every other registered handler |
getServiceResourceResolver(SUBSERVICE) in the consumer |
getAdministrativeResourceResolver is removed from the CS SDK |
Leader-only handlers must implement TopologyEventListener and check isLeader |
A simple run-mode check fires on every author cluster pod — TopologyEventListener is the supported way to elect a single leader |
handleEvent()runs synchronously on a shared OSGi thread. Doing repository, network, or workflow work inline blocks event delivery for every other handler subscribed to anything. Always offload to aJobConsumer.
Routing — is this the right skill?
Use this skill when the source listens to a non-resource OSGi Event Admin topic:
| Source topic | Description |
|---|---|
com.day.cq.replication.ReplicationEvent.EVENT_TOPIC |
Replication actions (activate, deactivate, etc.) |
com/adobe/granite/workflow/* |
Workflow lifecycle events |
| Custom OSGi topics posted by another bundle | Inter-bundle event signaling |
| Other non-resource OSGi events | Any OSGi event that is not a resource-change topic |
Route elsewhere when:
| Source observes… | Use instead |
|---|---|
| Repository content (page, asset, property added/changed/removed) | resource-change-listener skill — ResourceChangeListener is the supported API on CS |
| External system notification (Adobe I/O Events, App Builder, webhooks, downstream services) | AEM Eventing — cloud-native, runs outside AEM, distinct from OSGi Event Admin |
Anything subscribed to org/apache/sling/api/resource/Resource/* |
resource-change-listener skill — those OSGi resource topics are a deprecated internal Sling dispatcher detail |
Do not subscribe a new EventHandler to org/apache/sling/api/resource/Resource/ADDED|CHANGED|REMOVED. Those topics are an internal Sling dispatcher detail, deprecated as an application-facing API. Use ResourceChangeListener for resource observation.
Where to find topic constants
Always subscribe via a documented topic constant — never invent or copy-paste a topic string. The canonical constants live in the producing bundle's API:
| Producing API | Constant |
|---|---|
| Replication | com.day.cq.replication.ReplicationEvent.EVENT_TOPIC |
| Workflow | com.adobe.granite.workflow.event.WorkflowEvent.EVENT_TOPIC — combine with WorkflowEvent.EVENT_TYPE property to discriminate the sub-event |
| Sling Jobs (lifecycle) | org.apache.sling.event.jobs.NotificationConstants.* |
| Custom bundle topics | Check the producing bundle's source or documentation for its declared static final String topic constant |
A typo'd topic string compiles fine and silently subscribes to a topic that nothing posts to — the handler is ACTIVE but never fires. Reference the constant in code instead of duplicating the literal string.
Classification — choose before making any changes
Implements EventHandler for a non-resource topic and handleEvent() only enqueues jobs
→ Already compliant — verify against the Review Checklist only.
Implements EventHandler for a non-resource topic and handleEvent() contains business logic (resolver, JCR ops, heavy processing)
→ Apply E1–E5.
Implements javax.jcr.observation.EventListener for a concern that cannot be expressed as a ResourceChangeListener (rare — most legacy JCR listeners should route to the resource-change-listener skill)
→ Apply E0 (convert to EventHandler for the appropriate non-resource topic) then E1–E5. If unsure whether RCL covers it, prefer RCL and ask before falling through to this skill.
One pattern per session. If the bundle has multiple legacy handlers, migrate one class at a time.
Before starting: Read ../references/aem-cloud-service-pattern-prerequisites.md and apply SCR→DS, service-user, and SLF4J fixes if present in the same changeset.
Discovery
Detection is performed by the analyzer (../scripts/analyze.sh), run by the runbook:
bash ../scripts/analyze.sh <workspace-root> --pattern event-migration
Установить event-migration в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл event-migration?
AEM Cloud Service expert skill for OSGi Event Admin handlers (non-resource events). Covers migration of javax.jcr.observation.EventListener (residual non-resource cases) and OSGi EventHandler with inline business logic to the lightweight EventHandler + JobConsumer split. Includes routing rules (resource events go to resource-change-listener, external notification goes to AEM Eventing), TopologyEventListener for leader-only execution, replication and workflow event patterns, service-user setup, review checklist, troubleshooting, and common pitfalls.
Как установить скилл event-migration?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл event-migration запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic