apache / apache/shenyu

[BUG] NamespacePluginServiceImpl.create never publishes a sync event; new namespace-plugin relation never reaches the gateway

Open Beginner friendly
#6,537 1 comment 0 reactions 0 assignees View on GitHub
admin priority: high type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
`create` inserts `NamespacePluginRelDO` and returns, but never calls `namespacePluginEventPublisher.onCreated(vo)`. The publisher's `onCreated` (line 63) publishes both `DataChangedEvent(PLUGIN, CREATE)` for gateway sync and a `NamespacePluginCreatedEvent` for audit — it is simply never invoked from `create`. Every other mutating method in this service publishes (`update`->`onUpdated`, `delete`->`onDeleted`, `enabled`->`onEnabled`).

## Location
```
shenyu-admin/.../service/impl/NamespacePluginServiceImpl.java:94-103
namespacePluginEventPublisher.onCreated at NamespacePluginEventPublisher.java:63
```

## Impact
A plugin added to a namespace via `POST /namespace-plugin/{namespaceId}/{pluginId}` is saved in the admin DB but never pushed to the bootstrap/gateway. The plugin is not active in that namespace until a manual `syncPluginAll`/`syncPluginData` is invoked. No audit log entry is created either.

## Suggested fix
After `insertSelective`, fetch the VO via `selectByPluginIdAndNamespaceId(pluginId, namespaceId)` and call `namespacePluginEventPublisher.onCreated(vo)`.

## Related existing issue(s)
None

_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in shenyu-admin/.../service/impl/NamespacePluginServiceImpl.java at lines 94-103 and compare create with the other mutating methods. Read NamespacePluginEventPublisher.java at line 63 and verify that creation fetches the relation VO before publishing the event. Done means namespace plugin creation triggers gateway synchronization and the audit event without requiring manual sync.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.