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

io.mats3.api.intercept.CommonInterceptOutgoingMessagesContext Maven / Gradle / Ivy

There is a newer version: 0.19.22-2024-11-09
Show newest version
package io.mats3.api.intercept;

import java.util.List;

import io.mats3.MatsInitiator.InitiateLambda;
import io.mats3.api.intercept.MatsOutgoingMessage.MatsEditableOutgoingMessage;

/**
 * Common elements of intercepting messages for both Initiate and Stage.
 *
 * @author Endre Stølsvik - 2021-01-08 20:00 - http://endre.stolsvik.com
 */
public interface CommonInterceptOutgoingMessagesContext {
    /**
     * @return the current list of outgoing messages after the user lambda have run - and after previous interceptors
     *         have run, which might have added, or removed messages.
     */
    List getOutgoingMessages();

    /**
     * To add a new message, you may initiate it here. Notice that any interceptors that are invoked later than this
     * (interceptor was added later) will have this message show up in its {@link #getOutgoingMessages()}.
     */
    void initiate(InitiateLambda lambda);

    /**
     * To remove an outgoing message, you may invoke this method, providing the unique
     * {@link MatsOutgoingMessage#getMatsMessageId() MatsMessageId}. Notice that any interceptors that are invoked later
     * than this (interceptor was added later) will thus not see this message in its {@link #getOutgoingMessages()}.
     *
     * @param matsMessageId
     *            the unique MatsMessageId, gotten from {@link MatsOutgoingMessage#getMatsMessageId()}.
     */
    void cancelOutgoingMessage(String matsMessageId);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy