You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cs...@apache.org on 2023/01/24 08:52:03 UTC

[sling-org-apache-sling-distribution-journal-messages] branch master updated: Create MessagingProvider poller method with support for filter properties (#13)

This is an automated email from the ASF dual-hosted git repository.

cschneider pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal-messages.git


The following commit(s) were added to refs/heads/master by this push:
     new f71622b  Create MessagingProvider poller method with support for filter properties (#13)
f71622b is described below

commit f71622b3a6bec5767dbb7fd2c5e3817f60b4c6a5
Author: José Correia <37...@users.noreply.github.com>
AuthorDate: Tue Jan 24 09:51:58 2023 +0100

    Create MessagingProvider poller method with support for filter properties (#13)
    
    * Create MessagingProvider poller method with support for filter properties
    
    * Fix
    
    * fix
    
    * fix
    
    * Fix
    
    * Add method to create filters, on the mesaging provider
    
    * Fix
    
    * Update implementation to use Map<String, String> for filters, to promote abstraction and less API changes
    
    * Small fixes
    
    * Increment package version
    
    * Improve filterProperties documentation
    
    * Fix OSGI version and improve Javadoc
    
    Co-authored-by: josec <jo...@adobe.com>
---
 .../sling/distribution/journal/MessagingProvider.java   | 17 +++++++++++++++++
 .../apache/sling/distribution/journal/package-info.java |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/distribution/journal/MessagingProvider.java b/src/main/java/org/apache/sling/distribution/journal/MessagingProvider.java
index 9f06bb8..bb79381 100644
--- a/src/main/java/org/apache/sling/distribution/journal/MessagingProvider.java
+++ b/src/main/java/org/apache/sling/distribution/journal/MessagingProvider.java
@@ -20,6 +20,7 @@ package org.apache.sling.distribution.journal;
 
 import java.io.Closeable;
 import java.net.URI;
+import java.util.Map;
 
 /**
  * Messaging abstraction for a journal based messaging like Apache Kafka.
@@ -55,6 +56,22 @@ public interface MessagingProvider {
      */
     Closeable createPoller(String topicName, Reset reset, String assign, HandlerAdapter<?>... adapters);
 
+    /**
+     * Create a poller which listens to a topic and starts at a given reset or assigned offset.
+     * 
+     * @param topicName name of the topic
+     * @param reset fallback in case no assign is given or the assigned offset not valid
+     * @param assign opaque implementation dependent assign string (can be null)
+     * @param filterProperties List of properties used to filter the topic messages.
+     * Only messages that match all filterProperties keys and values will be received.
+     * @param adapters list of listener adapters
+     * @return closeable handle of the poller
+     */
+    default Closeable createPoller(String topicName, Reset reset, String assign, Map<String, String> filterProperties,
+            HandlerAdapter<?>... adapters) {
+        return createPoller(topicName, reset, assign, adapters);
+    }
+
     /**
      * Validate that a topic is suitably set up for the messaging implementation
      * 
diff --git a/src/main/java/org/apache/sling/distribution/journal/package-info.java b/src/main/java/org/apache/sling/distribution/journal/package-info.java
index b64492c..5252a37 100644
--- a/src/main/java/org/apache/sling/distribution/journal/package-info.java
+++ b/src/main/java/org/apache/sling/distribution/journal/package-info.java
@@ -16,6 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-@org.osgi.annotation.versioning.Version("1.4.0")
+@org.osgi.annotation.versioning.Version("1.5.0")
 package org.apache.sling.distribution.journal;