Class MessageFilter


  • @Component("MessageFilter")
    public class MessageFilter
    extends Object
    Message filter used in listeners.
    • Constructor Detail

      • MessageFilter

        public MessageFilter​(com.fasterxml.jackson.databind.ObjectMapper mapper)
    • Method Detail

      • get

        public String get​(byte[] payload,
                          String path)
        Filters so that only specific messages fall into the listener. e.g. @StreamListener(target = TestExchange.INPUT, condition = "headers['type']=='CustomerWithFilter', @MessageFilter.get(payload,'content/name')=='Luke'")

        In this example, we are filtering so that, only when the content of the name field is Luke, the message is received by the listener. It receives as a parameter the payload and the path of what should be filtered.

        Parameters:
        payload - payload
        path - path
        Returns:
        the content if it has, or null.
      • get

        public String get​(com.totvs.tjf.core.message.TOTVSMessage<?> message,
                          String path)
        Filters so that only specific messages fall into the listener. It receives as a parameter the TOTVSMessage and the path of what should be filtered.
        Parameters:
        message - a TOTVSMessage
        path - path
        Returns:
        get(byte[], String).
      • contains

        public Boolean contains​(byte[] payload,
                                String value)
        Check if it contains the value informed in the message.
        Parameters:
        payload - payload
        value - message
        Returns:
        true if it contains, otherwise false.
      • contains

        public Boolean contains​(com.totvs.tjf.core.message.TOTVSMessage<?> message,
                                String value)
        Check if it contains the value informed in the message.
        Parameters:
        message - a TOTVSMessage
        value - value
        Returns:
        contains(byte[], String).