検索

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

Chapter 21. Interceptors

download PDF

JBoss EAP messaging supports interceptors to intercept packets entering and exiting the server. Incoming and outgoing interceptors are called for every packet entering or exiting the server respectively. This allows custom code to be executed, such as for auditing or filtering packets. Interceptors can modify the packets they intercept. This makes interceptors powerful, but also potentially dangerous.

21.1. Implementing Interceptors

An interceptor must implement the Interceptor interface:

package org.apache.artemis.activemq.api.core.interceptor;

public interface Interceptor
{
   boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException;
}

The returned boolean value is important:

  • if true is returned, the process continues normally
  • if false is returned, the process is aborted, no other interceptors will be called and the packet will not be processed further by the server.

Interceptor classes should be added to JBoss EAP as a module. See Create a Custom Module in the JBoss EAP [Configuration Guide] for more information.

21.2. Configuring Interceptors

After adding their module to JBoss EAP as a custom module, both incoming and outgoing interceptors are added to the messaging subsystem configuration by using the management CLI.

Note

You must start JBoss EAP in "administrator only" mode before the new interceptor configuration will be accepted. See Running JBoss EAP in Admin-Only Mode in the JBoss EAP Configuration Guide] for details. Restart the server in normal mode after the new configuration is processed.

Each interceptor should be added according to the example management CLI command below. The examples assume each interceptor has already been added to JBoss EAP as a custom module.

/subsystem=messaging-activemq/server=default:list-add(name=incoming-interceptors, value={name => "foo.bar.MyIncomingInterceptor", module=>"foo.bar.interceptors"})

Adding an outgoing interceptor follows a similar syntax, as the example below illustrates.

/subsystem=messaging-activemq/server=default:list-add(name=outgoing-interceptors, value={name => "foo.bar.MyOutgoingInterceptor", module=>"foo.bar.interceptors"})
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

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

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

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

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

会社概要

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

© 2024 Red Hat, Inc.