All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.otto.synapse.annotation.MessageInterceptor Maven / Gradle / Ivy

Go to download

A library used at otto.de to implement Spring Boot based event-sourcing microservices.

There is a newer version: 0.33.1
Show newest version
package de.otto.synapse.annotation;

import de.otto.synapse.configuration.SynapseAutoConfiguration;
import de.otto.synapse.endpoint.EndpointType;
import de.otto.synapse.message.Message;
import de.otto.synapse.message.TextMessage;

import java.lang.annotation.*;

/**
 * An annotation that marks a method to be used as a {@link de.otto.synapse.endpoint.MessageInterceptor}.
 *
 * 

The annotated method must expect a single argument with parameter type * {@link TextMessage}, or {@link Message Message<String>}. The return type can either be * {@code Textmessage}, {@code Message<String>} or void. * *

{@code MessageInterceptors} can be used as {@link de.otto.synapse.endpoint.MessageFilter}: If * the annotated method is returning {@code null}, the intercepted message will be dropped, without * sending and/or processing it.

* *

Processing of {@code @MessageInterceptor} annotations is performed by * a {@link MessageInterceptorBeanPostProcessor} that is auto-configured in * {@link SynapseAutoConfiguration}. * * @see TextMessage * @see de.otto.synapse.endpoint.MessageInterceptor * @see MessageInterceptorBeanPostProcessor */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface MessageInterceptor { /** * The optional regexp pattern used to select channels by name. * *

By default, all channels will be intercepted.

* * @return regexp */ String channelNamePattern() default ".*"; /** * The optional {@code EndpointType}(s) that will be intercepted. * *

By default, both {@link EndpointType#SENDER} and {@link EndpointType#RECEIVER} endpoints will * be intercepted.

* * @return intercepted {@code EndpointType}(s) */ EndpointType[] endpointType() default {EndpointType.SENDER, EndpointType.RECEIVER}; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy