1 /**
2 * Copyright 2005-2015 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.ksb.messaging.service;
17
18 import java.util.List;
19 import java.util.Map;
20
21 import javax.xml.namespace.QName;
22
23 import org.kuali.rice.ksb.api.bus.ServiceConfiguration;
24 import org.kuali.rice.ksb.api.messaging.AsynchronousCall;
25 import org.kuali.rice.ksb.messaging.PersistedMessageBO;
26 import org.kuali.rice.ksb.messaging.PersistedMessagePayload;
27
28 /**
29 * Service for interfacing with the queue of asynchronous messages.
30 *
31 * @see org.kuali.rice.ksb.messaging.PersistedMessageBO
32 *
33 * @author Kuali Rice Team (rice.collab@kuali.org)
34 */
35 public interface MessageQueueService {
36
37 List<PersistedMessageBO> findByServiceName(QName serviceName, String methodName);
38
39 void delete(PersistedMessageBO routeQueue);
40
41 PersistedMessageBO save(PersistedMessageBO routeQueue);
42
43 List<PersistedMessageBO> findAll();
44
45 List<PersistedMessageBO> findAll(int maxRows);
46
47 /**
48 * Finds the PersistedMessageBO identified by the passed-in primary key, if one is
49 * available, otherwise returns a null object.
50 *
51 * @param routeQueueId The primary key routeQueueId of the message desired.
52 * @return A populated PersistedMessageBO instance, if the routeQueueId exists, otherwise
53 * a null object.
54 */
55 PersistedMessageBO findByRouteQueueId(Long routeQueueId);
56
57 // public List getNextDocuments();
58
59 /**
60 * Returns a List of RouteQueue documents which are queued for routing. Will not
61 * return more RouteQueues than the value of maxDocuments.
62 */
63 List<PersistedMessageBO> getNextDocuments(Integer maxDocuments);
64
65 PersistedMessagePayload findByPersistedMessageByRouteQueueId(Long routeQueueId);
66
67 /**
68 * Finds the persisted messages that match the values passed into the
69 * criteriaValues Map, with an auto-wildcard function, if no wildcard
70 * is passed in.
71 *
72 * @param criteriaValues A Map of Key/Value pairs, where the Key is a string holding the field
73 * name, and the Value is a string holding the value to match.
74 * @param maxRows the maximum number of rows to return from the query. If -1, then all rows will be returned.
75 * @return A populated (or empty) list containing the results of the search. If no matches are made,
76 * an empty list will be returned.
77 */
78 List<PersistedMessageBO> findByValues(Map<String, String> criteriaValues, int maxRows);
79
80 /**
81 * Used to determine the maximum number of retries allowed by the system before the
82 * message goes into Exception.
83 *
84 * @return The max retry attempts set in the system.
85 */
86 Integer getMaxRetryAttempts();
87
88 }