You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2019/12/15 18:19:28 UTC
[sling-org-apache-sling-commons-messaging] 02/02: SLING-5643
Provide a simple messaging API
This is an automated email from the ASF dual-hosted git repository.
olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-messaging.git
commit 6c1ba41c5c0e063e9941d45b25c28b19326c1502
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Dec 10 11:25:54 2019 +0100
SLING-5643 Provide a simple messaging API
Make API very simple
---
README.md | 13 +--------
.../sling/commons/messaging/MessageService.java | 18 +++---------
.../org/apache/sling/commons/messaging/Result.java | 32 ----------------------
3 files changed, 5 insertions(+), 58 deletions(-)
diff --git a/README.md b/README.md
index f7eade8..7170f6f 100644
--- a/README.md
+++ b/README.md
@@ -6,15 +6,4 @@
This module is part of the [Apache Sling](https://sling.apache.org) project.
-Simple API for sending *message*s to *recipient*s.
-
-`MessageService`
-----------------
- * `send(String, String)` - takes a *message* and a *recipient*, e.g.
- * send("A Message to You, Rudy", "rudy@ghosttown") - send a mail to Rudy in Ghost Town
- * send("Hello Apache!", "+1.919.573.9199") - send a fax to the ASF
- * `send(String, String, Map)` - takes a *message*, a *recipient* and additional *data* useful for the underlying implementation to process and/or send the message
-
-`Result<T>`
------------
- * `getMessage():T` - should return a serialized form of the sent *message*
+Common API for services sending messages.
diff --git a/src/main/java/org/apache/sling/commons/messaging/MessageService.java b/src/main/java/org/apache/sling/commons/messaging/MessageService.java
index 247b39c..05aa79e 100644
--- a/src/main/java/org/apache/sling/commons/messaging/MessageService.java
+++ b/src/main/java/org/apache/sling/commons/messaging/MessageService.java
@@ -18,28 +18,18 @@
*/
package org.apache.sling.commons.messaging;
-import java.util.Map;
import java.util.concurrent.CompletableFuture;
import org.jetbrains.annotations.NotNull;
import org.osgi.annotation.versioning.ProviderType;
@ProviderType
-public interface MessageService {
+public interface MessageService<T> {
/**
- * @param message the message to send
- * @param recipient the recipient of the message
- * @return result of sending the message
+ * @param message the message to send
+ * @return the sent message
*/
- CompletableFuture<Result> send(@NotNull final String message, @NotNull final String recipient);
-
- /**
- * @param message the message to send
- * @param recipient the recipient of the message
- * @param data additional information (e.g. attachments) and/or parameters (e.g. sender) for the message
- * @return result of sending the message
- */
- CompletableFuture<Result> send(@NotNull final String message, @NotNull final String recipient, @NotNull final Map data);
+ CompletableFuture<T> sendMessage(@NotNull final T message);
}
diff --git a/src/main/java/org/apache/sling/commons/messaging/Result.java b/src/main/java/org/apache/sling/commons/messaging/Result.java
deleted file mode 100644
index 7d9d547..0000000
--- a/src/main/java/org/apache/sling/commons/messaging/Result.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.commons.messaging;
-
-import org.jetbrains.annotations.Nullable;
-import org.osgi.annotation.versioning.ProviderType;
-
-@ProviderType
-public interface Result<T> {
-
- /**
- * @return serialized form of the sent message
- */
- @Nullable T getMessage();
-
-}