001 /**
002 * Copyright 2005-2014 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.ksb.messaging.service;
017
018 import java.util.List;
019 import java.util.Map;
020
021 import javax.xml.namespace.QName;
022
023 import org.kuali.rice.ksb.api.bus.ServiceConfiguration;
024 import org.kuali.rice.ksb.api.messaging.AsynchronousCall;
025 import org.kuali.rice.ksb.messaging.PersistedMessageBO;
026 import org.kuali.rice.ksb.messaging.PersistedMessagePayload;
027
028 /**
029 * Service for interfacing with the queue of asynchronous messages.
030 *
031 * @see org.kuali.rice.ksb.messaging.PersistedMessageBO
032 *
033 * @author Kuali Rice Team (rice.collab@kuali.org)
034 */
035 public interface MessageQueueService {
036
037 List<PersistedMessageBO> findByServiceName(QName serviceName, String methodName);
038
039 void delete(PersistedMessageBO routeQueue);
040
041 PersistedMessageBO save(PersistedMessageBO routeQueue);
042
043 List<PersistedMessageBO> findAll();
044
045 List<PersistedMessageBO> findAll(int maxRows);
046
047 /**
048 * Finds the PersistedMessageBO identified by the passed-in primary key, if one is
049 * available, otherwise returns a null object.
050 *
051 * @param routeQueueId The primary key routeQueueId of the message desired.
052 * @return A populated PersistedMessageBO instance, if the routeQueueId exists, otherwise
053 * a null object.
054 */
055 PersistedMessageBO findByRouteQueueId(Long routeQueueId);
056
057 // public List getNextDocuments();
058
059 /**
060 * Returns a List of RouteQueue documents which are queued for routing. Will not
061 * return more RouteQueues than the value of maxDocuments.
062 */
063 List<PersistedMessageBO> getNextDocuments(Integer maxDocuments);
064
065 PersistedMessagePayload findByPersistedMessageByRouteQueueId(Long routeQueueId);
066
067 /**
068 * Finds the persisted messages that match the values passed into the
069 * criteriaValues Map, with an auto-wildcard function, if no wildcard
070 * is passed in.
071 *
072 * @param criteriaValues A Map of Key/Value pairs, where the Key is a string holding the field
073 * name, and the Value is a string holding the value to match.
074 * @param maxRows the maximum number of rows to return from the query. If -1, then all rows will be returned.
075 * @return A populated (or empty) list containing the results of the search. If no matches are made,
076 * an empty list will be returned.
077 */
078 List<PersistedMessageBO> findByValues(Map<String, String> criteriaValues, int maxRows);
079
080 /**
081 * Used to determine the maximum number of retries allowed by the system before the
082 * message goes into Exception.
083 *
084 * @return The max retry attempts set in the system.
085 */
086 Integer getMaxRetryAttempts();
087
088 }