Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 21. Interceptors


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;
}
Copy to Clipboard Toggle word wrap

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"})
Copy to Clipboard Toggle word wrap

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"})
Copy to Clipboard Toggle word wrap
Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat