Skip to content

Commit 02e0a38

Browse files
authored
Change upload plugin 2 (apache#908)
* add plugin jar * change_upload_plugin_2
1 parent f7f5311 commit 02e0a38

File tree

2 files changed

+6
-99
lines changed

2 files changed

+6
-99
lines changed

docs/developer/custom-plugin.md

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -310,55 +310,9 @@ shenyu:
310310
* use `ShenyuAdmin - BasicConfig - Plugin` add plugin in `pluginJar` click upload button
311311
* Custom ShenyuPlugin can be started by loading third-party jars into the `-cp` directory if it depends on other third-party packages in shenyu-bootstrap
312312

313-
Tips: The Upload jar plugin does not support hot loading.
314-
If you need to modify the jar online. You can make a new jar. Go through the above steps again. The class name cannot be duplicated from the last upload
315-
plugin uploaded for the first time
313+
Tips:
316314

317-
```java
318-
public class CustomPluginV1 extends AbstractShenyuPlugin {
319-
private static final Logger LOG = LoggerFactory.getLogger(CustomPluginV1.class);
320-
321-
protected Mono<Void> doExecute(ServerWebExchange exchange, ShenyuPluginChain chain, SelectorData selectorData, RuleData rule) {
322-
LOG.info(".......... function plugin start CustomPluginV1............");
323-
return chain.execute(exchange);
324-
}
325-
326-
@Override
327-
public int getOrder() {
328-
return 0;
329-
}
330-
331-
@Override
332-
public String named() {
333-
return "CustomPluginV1";
334-
}
335-
}
336-
```
337-
338-
Now we need to change it
339-
340-
Delete CustomPluginV1 in the admin interface
315+
The Upload jar package plugin supports hot loading
316+
If you need to modify the jar online. You can make a new jar. And raise the version number, for example '1.0.1' to '1.0.2'
341317

342-
And recreate CustomPluginV2
343-
344-
```java
345-
public class CustomPluginV2 extends AbstractShenyuPlugin {
346-
private static final Logger LOG = LoggerFactory.getLogger(CustomPluginV2.class);
347-
348-
protected Mono<Void> doExecute(ServerWebExchange exchange, ShenyuPluginChain chain, SelectorData selectorData, RuleData rule) {
349-
LOG.info(".......... function plugin start CustomPluginV2............");
350-
return chain.execute(exchange);
351-
}
352-
353-
@Override
354-
public int getOrder() {
355-
return 0;
356-
}
357-
358-
@Override
359-
public String named() {
360-
return "CustomPluginV2";
361-
}
362-
}
363-
```
364318

i18n/zh/docusaurus-plugin-content-docs/current/developer/custom-plugin.md

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -317,55 +317,8 @@ shenyu:
317317
* 进入 ShenyuAdmin - BasicConfig - Plugin 进行添加 plugin 在 pluginJar 中可以添加自定义的 plugin Jar 包
318318
* 自定义的 ShenyuPlugin 如果依赖了其他的第三方包可以 ShenyuBootstrap 启动是加载到 -cp 的第三方jar包目录
319319

320-
注意: 上传jar包插件不支持热加载.
321-
如果你需要在线修改jar包. 你可以重新打一个jar包.把上述步骤重新走一遍.这里的类名不能与上次上传相重复
320+
注意:
322321

323-
第一次上传的 plugin
322+
上传jar包插件支持热加载
323+
如果你需要在线修改jar包. 你可以重新打一个jar包. 并且提升版本号, 例如 `1.0.1` 升高至 `1.0.2`
324324

325-
```java
326-
public class CustomPluginV1 extends AbstractShenyuPlugin {
327-
private static final Logger LOG = LoggerFactory.getLogger(CustomPluginV1.class);
328-
329-
protected Mono<Void> doExecute(ServerWebExchange exchange, ShenyuPluginChain chain, SelectorData selectorData, RuleData rule) {
330-
LOG.info(".......... function plugin start..CustomPluginV1............");
331-
return chain.execute(exchange);
332-
}
333-
334-
@Override
335-
public int getOrder() {
336-
return 0;
337-
}
338-
339-
@Override
340-
public String named() {
341-
return "CustomPluginV1";
342-
}
343-
}
344-
```
345-
346-
此时需要修改
347-
348-
在admin 界面 删除 CustomPluginV1
349-
350-
并且重新创建 CustomPluginV2
351-
352-
```java
353-
public class CustomPluginV2 extends AbstractShenyuPlugin {
354-
private static final Logger LOG = LoggerFactory.getLogger(CustomPluginV2.class);
355-
356-
protected Mono<Void> doExecute(ServerWebExchange exchange, ShenyuPluginChain chain, SelectorData selectorData, RuleData rule) {
357-
LOG.info(".......... function plugin start..CustomPluginV2............");
358-
return chain.execute(exchange);
359-
}
360-
361-
@Override
362-
public int getOrder() {
363-
return 0;
364-
}
365-
366-
@Override
367-
public String named() {
368-
return "CustomPluginV2";
369-
}
370-
}
371-
```

0 commit comments

Comments
 (0)