エージェント記述子の完成
エージェント記述子 (agent.adsc) を指定して、 エージェントをバインドするエンティティー、エージェントで処理するイベント、およびルーティング・ロジックを定義する必要があります。
始める前に
このタスクについて
エージェント記述子ファイルで、イベントに適用するルーティング条件を定義します。ビジネス・モデルのイベント・タイプおよびエンティティー・タイプを参照するビジネス語彙が、記述子にあります。
このエージェント記述子ファイルには、エージェント・ロジックを定義するためにエディターで入力する必要があるテンプレートが含まれます。
手順
タスクの結果
次のエージェント記述子は、airport エンティティーにバインドされ、2 つのイベントを処理する airport agent を示しています。

- エージェントの名前。
- バインド・エンティティーのタイプ。
- エージェントの優先度。
- エージェントが listen し、処理するイベント・タイプ。
- バインド・エンティティー。
- イベント内のバインド・エンティティーに対応するストリングを取得する式。
- イベントのフィルタリング。
- イベント期間。
- temperature reading,
where this location comes from the location of this temerature reading
with a horizon of 7 days
1 週間後に、過去 7 日間の温度読み取りがエージェントに保管されます。
その後、過去 1 週間のこのデータを集約するルールを定義することができます。例
- 1 つのイベントを処理するエージェント
- 次の例では、エージェントのバインド・エンティティーが ticket で、エージェントが ticket check in event を listen します。
ticket エンティティーの ID は、ticket check in event に含まれる ID です。
'ticket checkin agent' is an agent related to a ticket, processing events: - ticket checkin event, where this ticket comes from the ticket of this ticket checkin eventヒント: target プレースホルダーでは、イベントを暗黙的に参照する変数を使用できます。例えば、the ticket of this ticket checkin event と記述する代わりに、the ticket と記述することができます。 - 優先度と条件を持つ複数のイベントを処理するエージェント
次のエージェント記述子は、airport エンティティーにバインドされ、2 つのイベントを処理する airport agent を示しています。 エージェントの優先度は high です。 優先度の低い別のエージェントが同じイベントを listen している場合、AirportAgent エージェントが先にそれらのイベントを処理します。このエージェント記述には、airport open event のフィルター条件も含まれています。 エージェントは、8 月に発生した airport open event だけを処理します。
'AirportAgent' is an agent related to an airport, whose priority is High, processing events: - airport closed event, where this airport comes from the airport of this airport closed event - airport open event when the datetime of this airport open event is in August, where this airport comes from the airport of this airport open event- 複数のイベントを処理するエージェント (イベントの 1 つには期間が指定されています)
- 次のエージェント記述子は、airport エンティティーにバインドされ、2 つのイベントを処理する airport agent を示しています。
エージェントは、各イベントのタイム・スタンプを基準にして、そこから 15 日間、airport open event を作業メモリー内に保持します。現在時刻がこの期間の終わりに達すると、airport open event はエージェントのメモリーから削除されます。エージェント記述子に airport closed event の期間は指定されていないため、それらのイベントはエージェントまたはソリューションの最大期間にわたって作業メモリー内に保持されます。
'AirportAgent' is an agent related to an airport, processing events: - airport closed event, where this airport comes from the airport of this airport closed event - airport open event, where this airport comes from the airport of this airport open event with a horizon of 15 days - イベントの 2 つのフィールドに基づくエンティティー ID を持つイベントを処理するエージェント
- 次の例では、エージェントのバインド・エンティティーが customer で、エージェントが subscription event を listen します。
customer エンティティーの ID は、subscription event に含まれる main contact の first name と last name から構成されます。
'subscription agent' is an agent related to a customer, processing events: - subscription event, where this customer comes from the first name of the main contact of this subscription event + "/" + the last name of the main contact of this subscription event - エンティティーがバインド・エンティティーの親タイプであるイベントを処理するエージェント
- エンティティーの親タイプにイベントをバインドすることができます。
例えば、次のビジネス・モデルを考えてみます。
エージェントが patient エンティティーに関連している場合、このイベントを person エンティティーにバインドすることができます。 この例では、ランタイム環境は、 イベントの person エンティティーが patient のインスタンスか doctor のインスタンスかをチェックします。 エージェントは、イベントのエンティティーが patient である場合にのみ、イベントを処理します。a person is a business entity identified by a string, named the name. a patient is a person . a doctor is a person . a message to person is a business event . a message to person is related to a person. a message to patient is a business event . a message to patient is related to a patient.'healthcare' is an agent related to a patient, processing events: - message to person, where this patient comes from the person of this message to person - バインド・エンティティーを持たないエージェント
ルール・エージェントにはバインド・エンティティーが必要ですが、 エンティティーにバインドされていない Java エージェントを開発することが可能です。 エージェントは、エンティティーへのアクセスを必要とせずに、イベントのストリームを受け取り、イベント・ストリームに基づくアウトバウンド・イベントを出力できます。 例えば、多数のトランザクションが発生したときにアラートをトリガーする場合です。
エンティティーがない Java エージェントを作成するには、 次の例に示されているように、is related to 節と where <mapping> 節を省略します。
'transactionagent.MyAgent' is an agent, processing events: - transaction event