Class AddMessageIDHandler

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, MessageHandler

public class AddMessageIDHandler extends AbstractHeaderGeneratingMessageHandler
Handler implementation that adds a wsa:MessageID header to the outbound SOAP envelope.

The value from WSAddressingContext.getMessageIDURI() will be used, if present. If not, then the value generated via the locally-configured strategy getIdentifierGenerationStrategy() will be used. If neither of those sources are available, then a random "urn:uuid:..." URI value will be generated internally using UUID.

  • Field Details

    • log

      private org.slf4j.Logger log
    • identifierGenerationStrategy

      private IdentifierGenerationStrategy identifierGenerationStrategy
      Strategy for generating identifiers.
  • Constructor Details

    • AddMessageIDHandler

      public AddMessageIDHandler()
  • Method Details

    • getIdentifierGenerationStrategy

      @Nullable public IdentifierGenerationStrategy getIdentifierGenerationStrategy()
      Get the identifier generation strategy.
      the strategy, or null
    • setIdentifierGenerationStrategy

      public void setIdentifierGenerationStrategy(@Nullable IdentifierGenerationStrategy strategy)
      Set the identifier generation strategy.
      strategy - the new strategy
    • doInvoke

      protected void doInvoke(@Nonnull MessageContext messageContext) throws MessageHandlerException
      Performs the handler logic.
      Specified by:
      doInvoke in class AbstractMessageHandler
      messageContext - the message context on which to invoke the handler
      MessageHandlerException - if there is an error invoking the handler on the message context
    • getMessageID

      @Nonnull protected String getMessageID(MessageContext messageContext)
      Get the effective message ID value to issue in the outbound message.
      messageContext - the current message context
      the retrieved or generated message ID