NotesAgent.Run 返回值

发布于 2024-12-03 16:39:09 字数 248 浏览 0 评论 0原文

我有一个运行其他代理的代理(出于我的目的,我们将这些代理称为“子代理”)。每次代理运行时,它都会记录其操作,无论它运行成功还是生成错误。我现在想要的是记录子代理是否成功运行(使用 NotesAgent.Run/RunOnServer)。文档说,如果子代理运行成功,此方法将返回 0。但是当我强制子代理发生错误时,Run 方法仍然返回 0。有没有办法让它在发生错误时返回其他值?或者是否有另一种方法可以将子代理事件记录到主代理的数据库中。请注意,子代理在其他数据库上运行。多谢! :D

I have an agent that runs other agents (let's call these 'sub-agents' for my purpose) .Each time the agent run, it logs it's actions, whether it ran successfully or generated an error. What I want now is to log also if the sub-agents would successfully run or not (using NotesAgent.Run/RunOnServer). The documentation says that this method returns 0 if the sub-agent run successfully. But when I force an error to a subagent, the Run method still returns 0. Is there a way that I can make it return other values when an error occurs? Or is there another way that I can log the sub-agents event to the main agent's database. Note that the sub-agents runs on other databases. Thanks a lot! :D

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

怼怹恏 2024-12-10 16:39:09

可能是将代理链接在一起的一个很好的指南。

This may be a good guide to chaining agents together.

失与倦" 2024-12-10 16:39:09

代理可能正在异步运行。当您启动代理时,它会成功启动并返回 0。您可以通过单步执行代码轻松确定这一点,如果代理启动得非常快,您就知道它们可能尚未实际运行,而是刚刚启动。

如果是这种情况,您可能会受益于在笔记代理之外拥有一个进行日志记录的中心位置。它可以是单个文本文件,尽管您必须考虑锁和并发性。或者,您可以使用公共“ID”将消息通过电子邮件发送到另一个 Notes 数据库,以便您可以将单个代理运行会话分组在一起。除了 Notes 代理之外,您还可以通过许多其他方式来执行此操作。

It might be that the agents are running asynchronously. When you start the agent, it starts successfully and returns 0. You can determine this easily by stepping through the code and if the agents fire off very quickly, you know they likely haven't actually run but were just initiated.

If that's the case you may benefit from having a central place outside of the notes agents where you do your logging. It could be a single text file, although you'll have to think about locks and concurrency. Or you could have messages emailed into another Notes database with a common "ID" so you can group together the single agent run-session. There are many other ways you could do this as well, outside of Notes agents.

嘦怹 2024-12-10 16:39:09

@giulio 链接的文章概述了在“链接”代理之间有效传递数据的好方法。

@Jairo 可能面临的文章中的示例的一个问题是,其 noteid 被传递到子代理的文档(我们称之为“代理”文档)存储在引发代理调用的数据库中。如果子代理位于同一数据库中,这很好,但是原始描述指定子代理有时位于不同的数据库中。这意味着如果您想从子代理中检索和更新代理,您首先需要获取调用数据库的句柄。

现在,在某些情况下,子代理可能不关心从哪里调用它,但仍然希望将一些结果写入代理。

因此,一个好的方法是将代理存储在您知道始终可用的位置。例如,当通过 Notes 客户端上的调用链接代理时,您可以将代理文档存储在本地“bookmarks.nsf”中。它是一个系统数据库并且始终可用,因此是存储文档的好地方。然后,当您的子代理运行时,使用传入的“noteid”从 bookmarks.nsf 检索代理,而不必担心父代理所在的位置。完成后从书签数据库中删除代理文档可能是一个好习惯。

The article which @giulio linked to outlines a good approach to effectively pass data between "chained" agents.

The one problem with the example in the article which @Jairo may face is that the document whose noteid is being passed into the child agent (let's call it the "proxy" document) is stored in the database instigating the agent call. Which is fine if the sub-agent is in the same database, however the original description specifies that the sub-agent is sometimes in a different database. That means if you want to retrieve and update the proxy from within the sub-agent, you first need to get a handle back to the calling DB.

Now in some cases the sub-agent may not care where it has been called from but still wants to write some results to the proxy.

Therefore a good approach is to store the proxy in a place which you know will always be available. E.g. when chaining agents from a call made on a Notes client, you could store the proxy document in the local "bookmarks.nsf". It's a system database and is always available so is a good place to use to store documents. Then when your sub-agent runs, retrieve the proxy from bookmarks.nsf using the passed in "noteid" without worrying about where the parent agent resides. It's probably good practice to remove the proxy documents from the bookmarks db once you've finished.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文