このコンテンツは選択した言語では利用できません。

4.3. Events


Both the stateful and stateless knowledge sessions provide methods that allow you to register and remove listeners. Use ProcessEventListener objects to listen to process-related events (like starting or completing a process or entering or leaving a node.) Here are the different methods for it:
public interface ProcessEventListener {

  void beforeProcessStarted( ProcessStartedEvent event );
  void afterProcessStarted( ProcessStartedEvent event );
  void beforeProcessCompleted( ProcessCompletedEvent event );
  void afterProcessCompleted( ProcessCompletedEvent event );
  void beforeNodeTriggered( ProcessNodeTriggeredEvent event );
  void afterNodeTriggered( ProcessNodeTriggeredEvent event );
  void beforeNodeLeft( ProcessNodeLeftEvent event );
  void afterNodeLeft( ProcessNodeLeftEvent event );

}
Copy to Clipboard Toggle word wrap
You can create an audit log based on the information provided by these process listeners. Red Hat provides you with the following ones out-of the-box:
  1. Console logger: this outputs every event to the console.
  2. File logger: this outputs every event to an XML file. This log file might then be used in the IDE to generate a tree-based visualization of the events that occurred during execution.
  3. Threaded file logger: Because a file logger writes the events to disk only when closing the logger or when the number of events in the logger reaches a pre-defined threshold, it cannot be used when debugging processes at run-time. The threaded file logger writes the events to a file after a specified time interval, making it possible to use the logger to visualize progress in real-time, making it useful for debugging.
Use the KnowledgeRuntimeLoggerFactory to add a logger to your session:
KnowledgeRuntimeLogger logger =
    KnowledgeRuntimeLoggerFactory.newFileLogger( ksession, "test" );
// add invocations to the process engine here,
// e.g. ksession.startProcess(processId);
...
logger.close();
Copy to Clipboard Toggle word wrap

Note

When creating a console logger, pass the knowledge session for it as an argument.
The file logger must also be supplied requires the name of the log file to be created.
The threaded file logger requires the interval (in milliseconds) after which the events are to be saved.
You can open the log file in JBDS. To do so, go to the Audit View. Here you will see the events depicted in the form of a tree. (Anything that occurs between the before and after events is shown as a child of that event.)
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2026 Red Hat