This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-messaging.git
commit 4ae7ce15c88d0575605cbc27e5167a552ad130ca Author: Oliver Lietz <[email protected]> AuthorDate: Fri Apr 8 09:43:50 2016 +0000 SLING-5643 Provide a simple messaging API * use CompletableFuture instead of Future * remove Failure git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1738225 13f79535-47bb-0310-9956-ffa450edef68 --- README.md | 8 ---- .../apache/sling/commons/messaging/Failure.java | 43 ---------------------- .../sling/commons/messaging/MessageService.java | 6 +-- .../org/apache/sling/commons/messaging/Result.java | 12 ------ 4 files changed, 3 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index 929c3a7..ab8e26b 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,3 @@ Simple API for sending *message*s to *recipient*s. `Result<T>` ----------- * `getMessage():T` - should return a serialized form of the sent *message* - * `hasFailures():boolean` - should return `true` in case of failures, `false` otherwise - * `getFailures():Collection<Failure>` - should return the failures occurred when processing or sending the message - -`Failure` ---------- - * `getCode():String` - should return a failure code when available, e.g. an [SMTP Status Code](https://tools.ietf.org/html/rfc5248) - * `getType():String` - should return a failure type when available, e.g. invalid input (message too big) or transport failure (host unavailable) - * `getMessage():String` - should return a human readable failure message diff --git a/src/main/java/org/apache/sling/commons/messaging/Failure.java b/src/main/java/org/apache/sling/commons/messaging/Failure.java deleted file mode 100644 index 9a5997b..0000000 --- a/src/main/java/org/apache/sling/commons/messaging/Failure.java +++ /dev/null @@ -1,43 +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 javax.annotation.CheckForNull; - -import org.osgi.annotation.versioning.ProviderType; - -@ProviderType -public interface Failure { - - /** - * @return a failure code when available - */ - @CheckForNull String getCode(); - - /** - * @return a failure type when available - */ - @CheckForNull String getType(); - - /** - * @return a human readable failure message - */ - @CheckForNull String getMessage(); - -} 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 22e9763..820005d 100644 --- a/src/main/java/org/apache/sling/commons/messaging/MessageService.java +++ b/src/main/java/org/apache/sling/commons/messaging/MessageService.java @@ -19,7 +19,7 @@ package org.apache.sling.commons.messaging; import java.util.Map; -import java.util.concurrent.Future; +import java.util.concurrent.CompletableFuture; import javax.annotation.Nonnull; @@ -33,7 +33,7 @@ public interface MessageService { * @param recipient the recipient of the message * @return result of sending the message */ - Future<Result> send(@Nonnull final String message, @Nonnull final String recipient); + CompletableFuture<Result> send(@Nonnull final String message, @Nonnull final String recipient); /** * @param message the message to send @@ -41,6 +41,6 @@ public interface MessageService { * @param data additional information (e.g. attachments) and/or parameters (e.g. sender) for the message * @return result of sending the message */ - Future<Result> send(@Nonnull final String message, @Nonnull final String recipient, @Nonnull final Map data); + CompletableFuture<Result> send(@Nonnull final String message, @Nonnull final String recipient, @Nonnull final Map data); } diff --git a/src/main/java/org/apache/sling/commons/messaging/Result.java b/src/main/java/org/apache/sling/commons/messaging/Result.java index d335124..9abbcaa 100644 --- a/src/main/java/org/apache/sling/commons/messaging/Result.java +++ b/src/main/java/org/apache/sling/commons/messaging/Result.java @@ -18,8 +18,6 @@ */ package org.apache.sling.commons.messaging; -import java.util.Collection; - import javax.annotation.CheckForNull; import org.osgi.annotation.versioning.ProviderType; @@ -32,14 +30,4 @@ public interface Result<T> { */ @CheckForNull T getMessage(); - /** - * @return <code>true</code> in case of failures, <code>false</code> otherwise - */ - boolean hasFailures(); - - /** - * @return the failures occurred when processing or sending the message - */ - @CheckForNull Collection<Failure> getFailures(); - } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
