Duplicate content check imicroservice s used to classify input messages into duplicate and unique based on content in input XML at XPath provided using CPS. Depending on Cache Duration Time and Sleep Interval, input messages are retained in cache and sent on sleep intervals.
Configuration
Figure 1: Component Property Sheet
Validate Input
- yes: The microservice tries to validate the input received.
no: The microservice will not validate the input and hence the performance increases.
Error handling configuration
Allows configuring actions to be taken when an exception occurs during the execution. Following are the configuration options:
- JMS Error
- Response Generation Error
- Request Processing Error
- Invalid Request Error
Input Source
The source type that has to be taken as input. Choose one of the below:
- XML
- Text
Configure schema of input
Using schema editor, load/enter the XML schema for the input message.
Sleep Interval
The time gap (in milliseconds) with which duplicate messages are throttled through the Duplicate port.
Cache Duration Time
Time duration for which message should be retained in cache. If in case cache is not empty and duration exceeds, then cache is not cleaned until all messages are throttled to duplicate ports.
Cache Duration Time Unit
The unit of the cache duration time can be set here. While the default unit is milliseconds, other options are:
- Seconds
- Minutes
- Hours
- Days
Duplicate Identifier Source
The message is checked if it is duplicate of the earlier message based on the parameters below:
- Body (Text or XML)
- Header
XPath
Choose XPath from which content should be extracted.
Functional Demonstration
Scenario 1
Configure component as shown in Figure 1. Using Feeder send input messages and it can be observed that messages with the same "STNO" are classified into duplicate and unique and sent to respective displays.
Figure 2: Sample Event Process
Sample Input
Figure 3: Sent 10 messages with same "STNO"
Sample Output
Unique port :
Figure 4: Shows only 1 message which is unique, since cache has no messages at present.
Duplicate port
Figure 5: Shows 9 messages since they have same STNO as first message.
Useful Tips
- CPS does not accept negative values for sleep interval and cache duration. Only if values entered are non-negative Validate button press will pop-up Success message.
- If Cache time is zero, then component throttles messages to Unique port with no gap (sleep interval), irrespective of sleep interval being non-zero value.
- If sleep interval is zero, then cache is cleared as per cache duration time. While clearing cache, no messages are lost.