1 /** 2 * Copyright 2005-2012 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.kcb.api.service; 17 18 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; 19 import org.kuali.rice.kcb.api.message.MessageDTO; 20 import org.kuali.rice.kcb.api.exception.MessageDeliveryException; 21 import org.kuali.rice.kcb.api.exception.MessageDismissalException; 22 23 /** 24 * The KCB MessagingService provides an API to deliver messages 25 * to arbitrary multiple endpoints. 26 * 27 * @author Kuali Rice Team (rice.collab@kuali.org) 28 */ 29 public interface MessagingService { 30 /** 31 * Delivers a message 32 * 33 * @param message message to deliver 34 * @return identifier for the message 35 * @throws MessageDeliveryException if unable to deliver message. 36 * @throws RiceIllegalArgumentException if the message is null. 37 */ 38 public Long deliver(MessageDTO message) throws MessageDeliveryException, RiceIllegalArgumentException; 39 /** 40 * Removes a specific message and all deliveries 41 * 42 * @param messageId id of the message to remove 43 * @param user the user under which the action was taken 44 * @param cause the cause or action taken to remove the message 45 * @throws MessageDismissalException if no message for the given messageId is found. 46 * @throws RiceIllegalArgumentException if user, cause is null. 47 */ 48 public void remove(long messageId, String user, String cause) throws MessageDismissalException, RiceIllegalArgumentException; 49 50 /** 51 * Removes a specific message and all deliveries. Does not throw an exception if no message with the origin 52 * id is found. 53 * 54 * @param originId origin id of the message to remove 55 * @param user the user under which the action was taken 56 * @param cause the cause or action taken to remove the message 57 * @return Long the message id of the message removed, if any 58 * @throws MessageDismissalException if no message for the given messageId is found. 59 * @throws RiceIllegalArgumentException if originId is null 60 */ 61 public Long removeByOriginId(String originId, String user, String cause) throws MessageDismissalException, RiceIllegalArgumentException; 62 }