001 /** 002 * Copyright 2005-2012 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.kcb.api.service; 017 018 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; 019 import org.kuali.rice.kcb.api.message.MessageDTO; 020 import org.kuali.rice.kcb.api.exception.MessageDeliveryException; 021 import org.kuali.rice.kcb.api.exception.MessageDismissalException; 022 023 /** 024 * The KCB MessagingService provides an API to deliver messages 025 * to arbitrary multiple endpoints. 026 * 027 * @author Kuali Rice Team (rice.collab@kuali.org) 028 */ 029 public interface MessagingService { 030 /** 031 * Delivers a message 032 * 033 * @param message message to deliver 034 * @return identifier for the message 035 */ 036 public Long deliver(MessageDTO message) throws MessageDeliveryException, RiceIllegalArgumentException; 037 /** 038 * Removes a specific message and all deliveries 039 * 040 * @param messageId id of the message to remove 041 * @param user the user under which the action was taken 042 * @param cause the cause or action taken to remove the message 043 */ 044 public void remove(long messageId, String user, String cause) throws MessageDismissalException, RiceIllegalArgumentException; 045 046 /** 047 * Removes a specific message and all deliveries. Does not throw an exception if no message with the origin 048 * id is found. 049 * 050 * @param originId origin id of the message to remove 051 * @param user the user under which the action was taken 052 * @param cause the cause or action taken to remove the message 053 * @return Long the message id of the message removed, if any 054 */ 055 public Long removeByOriginId(String originId, String user, String cause) throws MessageDismissalException, RiceIllegalArgumentException; 056 }