public class MongoEventService extends AbstractEventService
EventService
MongoDB collectionConstructor and Description |
---|
MongoEventService(org.springframework.data.mongodb.core.MongoTemplate mongo,
String collection)
Construct a provider that works using the given Mongo instance and
collection name.
|
Modifier and Type | Method and Description |
---|---|
long |
count() |
boolean |
deleteEvent(Event event)
Delete an event from the provider.
|
List<Event> |
findEvents(String name,
int skip,
int limit)
Find any event matching the given name, using the paging criteria
|
Event |
getEvent(String id)
Fetch a specific event by unique ID
|
Event |
nextEvent(String serverId,
long latestScheduledTime,
boolean localDataOnly)
Retrieve the next event in the queue.
|
Event |
putEvent(Event event)
Adds an event to the provider.
|
public MongoEventService(org.springframework.data.mongodb.core.MongoTemplate mongo, String collection)
mongo
- the MongoDB template to usecollection
- the name of the MongoDB collectionpublic long count()
public List<Event> findEvents(String name, int skip, int limit)
EventService
name
- find events with the given nameskip
- the number of results to skiplimit
- the maximum number of results to retrievepublic Event nextEvent(String serverId, long latestScheduledTime, boolean localDataOnly)
serverId
- the identifier of the server taking the event (never null)latestScheduledTime
- the maximum scheduled time for eventslocalDataOnly
- true to limit searches to events that have server-specific
data matching the given server IDpublic Event getEvent(String id)
EventService
id
- the event IDpublic boolean deleteEvent(Event event)
EventService
event
- the event to deletepublic Event putEvent(Event event)
EventService
event
- the event to add (the event ID
must be nullCopyright © 2014. All rights reserved.