WebSphere Application Server for i5/OS, Version 6.1   
             オペレーティング・システム: i5/OS

             目次と検索結果のパーソナライズ化

アプリケーション通知サービスの使用

アプリケーション存続時間中に、単一 EAR ファイル内の個々の J2EE コンポーネント (サーブレット またはエンタープライズ Bean) は、互いにシグナル通知する必要があります。java:comp ネーム・スペースには、 通知で使用可能な EAR ファイル内のすべてのコンポーネントにバインドされるイベント・ソースがあります。

このタスクについて

以下は、EAR ファイル内のすべてのコンポーネントにバインドされる、 イベント・ソースに対する java:comp ネーム・スペース内の JNDI 名です。
java:comp/websphere/ApplicationNotificationService

同じアプリケーション内のコンポーネントは、 非同期イベントを発行し、このアプリケーション通知サービスを使用してイベント・リスナーを登録します。 開始 Bean を使用すると、 このようなイベント・リスナーをアプリケーションの始動時に登録することができます。 開始 Bean を使用しない場合、イベント・リスナーは、実行時に動的に登録されます。

プロシージャー

Enterprise Bean やサーブレットで アプリケーション通知サービスを使用するには、以下の例のようなコードを作成します。
InitialContext ic = new InitialContext();
EventSource appES = (EventSource)
		ic.lookup("java:comp/websphere/ApplicationNotificationService");
// now, the application can add a listener using the EventSource.addListener method.
// MyEventType is an interface.
MyEventType myListener = ...;
AppES.addListener(myListener);

// later another component can fire events as follows
InitialContext ic = new InitialContext();
EventSource appES = (EventSource)
ic.lookup("java:comp/websphere/ApplicationNotificationService");

// This highlights a constant string on the EventSource interface which
// specifies the 'java:comp/websphere/ApplicationNotificationService' string.
ic.lookup(appES.APPLICATION_NOTIFICATION_EVENT_SOURCE)
// now, the application can add a listener using the EventSource.addListener method.
MyEventType proxy = appES.getEventTrigger(MyEventType.class, false);
proxy.someEvent(someArguments);




関連タスク
イベント・リスナーの開発
タスク・トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 5:46:14 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.iseries.doc/info/iseries/asyncbns/tasks/tasb_appnotservice.html