Package com.totvs.tjf.messaging
Class MessageFilter
- java.lang.Object
-
- com.totvs.tjf.messaging.MessageFilter
-
@Component("MessageFilter") public class MessageFilter extends Object
Message filter used in listeners.
-
-
Constructor Summary
Constructors Constructor Description MessageFilter(com.fasterxml.jackson.databind.ObjectMapper mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Boolean
contains(byte[] payload, String value)
Check if it contains the value informed in the message.Boolean
contains(com.totvs.tjf.core.message.TOTVSMessage<?> message, String value)
Check if it contains the value informed in the message.String
get(byte[] payload, String path)
Filters so that only specific messages fall into the listener.String
get(com.totvs.tjf.core.message.TOTVSMessage<?> message, String path)
Filters so that only specific messages fall into the listener.
-
-
-
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
- payloadpath
- 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 theTOTVSMessage
and the path of what should be filtered.- Parameters:
message
- a TOTVSMessagepath
- 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
- payloadvalue
- 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 TOTVSMessagevalue
- value- Returns:
contains(byte[], String)
.
-
-