Class QueueNameDuplicationFilter
java.lang.Object
dk.cloudcreate.essentials.components.queue.postgresql.QueueNameDuplicationFilter
- All Implemented Interfaces:
dk.cloudcreate.essentials.components.foundation.postgresql.NotificationDuplicationFilter
public class QueueNameDuplicationFilter
extends Object
implements dk.cloudcreate.essentials.components.foundation.postgresql.NotificationDuplicationFilter
Custom filter to extract the "queue_name" property from the Postgresql
This filter is useful when dealing with multiple
Example: if 100 messages are queued for the same
Notification.getParameter() JSON content.This filter is useful when dealing with multiple
Notification's involving the same queue.Example: if 100 messages are queued for the same
QueueName in the same UnitOfWork, then the MultiTableChangeListener will notify
the PostgresqlDurableQueues with 100 TableChangeNotification's. Using the QueueNameDuplicationFilter the PostgresqlDurableQueues
will only receive a single TableChangeNotification for that specific QueueName. Filtering is only performed on Notifications
returned in a single database notification poll- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface dk.cloudcreate.essentials.components.foundation.postgresql.NotificationDuplicationFilter
dk.cloudcreate.essentials.components.foundation.postgresql.NotificationDuplicationFilter.TableNameDuplicationFilter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractDuplicationKey(com.fasterxml.jackson.databind.JsonNode parameterJson) Extracts the "queue_name" field from the given JSON parameter, if it exists.
ExampleNotification.getParameter()content:
-
Constructor Details
-
QueueNameDuplicationFilter
public QueueNameDuplicationFilter()
-
-
Method Details
-
extractDuplicationKey
public Optional<String> extractDuplicationKey(com.fasterxml.jackson.databind.JsonNode parameterJson) Extracts the "queue_name" field from the given JSON parameter, if it exists.
ExampleNotification.getParameter()content:{ "table_name" : "durable_queues", "sql_operation" : "INSERT", "id" : "d897f4eb-ed90-4b10-9479-971bf9b26fd3", "queue_name" : "TestQueue", "added_ts" : "2024-11-26T17:09:41.279749+01:00", "next_delivery_ts" : "2024-11-26T17:09:41.279749+01:00", "delivery_ts" : null, "is_dead_letter_message" : false, "is_being_delivered" : false }- Specified by:
extractDuplicationKeyin interfacedk.cloudcreate.essentials.components.foundation.postgresql.NotificationDuplicationFilter- Parameters:
parameterJson- a JsonNode representing the JSON structure of the notification parameter- Returns:
- an Optional containing the queue name if it exists, otherwise an empty Optional
-