Last active
July 8, 2018 10:13
-
-
Save marcosabel/ba75f534bc2c785dbaccd48444f51d23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Snippet of code used to evict invoices cache when mqtt messages arrive. We assume we have an mqttComponent and | |
// an invoiceService correctly defined in the current scope | |
mqttComponent.subscribeToTopicWithEmptyPayload("caches/invoices/+/evict",evictInvoiceCache(),1); | |
// ... | |
private Function<String,Void> evictInvoiceCache() { | |
return topic->{ | |
Pattern pattern = Pattern.compile("\\d+"); | |
Matcher matcher = pattern.matcher(topic); | |
matcher.find(); | |
invoiceService.evictInvoicesCache(matcher.group()); | |
return null; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment