Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

上下文超类判断的获取和转换 #65

Open
XieXiaoying opened this issue Jul 11, 2024 · 0 comments
Open

上下文超类判断的获取和转换 #65

XieXiaoying opened this issue Jul 11, 2024 · 0 comments

Comments

@XieXiaoying
Copy link

XieXiaoying commented Jul 11, 2024

一、场景描述

希望有一些通用的node,可以在不同的chain中复用。以直播场景为例,“我关注的正在直播的主播”和“首页直播推荐”这两个场景,我用两个chain编排,其中,都需要查询主播的信息,我希望“查询主播的信息”成为一个通用的算子。

二、尝试的办法

1、继承

为此,我想到一个解决办法,就是定义一个BaseContext,所有想用通用算子的chain的Context,都必须继承BaseContext,我在这个通用的算子里用如下方式获取BaseContext:

BaseContext context = this.getContextBean(BaseContext.class);

报如下错误:

Caused by: com.yomahub.liteflow.exception.NoSuchContextBeanException: this type is not in the context type passed in
	at com.yomahub.liteflow.slot.Slot.getContextBean(Slot.java:464)
	at com.yomahub.liteflow.core.NodeComponent.getContextBean(NodeComponent.java:258)

三、诉求

请教,继承是不是解决此类问题的比较合适的办法,希望后续迭代针对这个场景的能力。

@XieXiaoying XieXiaoying changed the title 继承场景使用liteflow编排 上下文超类判断的获取和转换 Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant