uk.co.shastra.hydra.messaging.messagefetchers.MultiFetcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hydra Show documentation
Show all versions of hydra Show documentation
Hydra is a simple, highly redundant pull-based messaging system. It uses CouchDb as its message store, and replication to deliver messages. It can be used by any language capable of making HTTP calls, and C# and Java client implementations are included.
The newest version!
package uk.co.shastra.hydra.messaging.messagefetchers;
import java.util.ArrayList;
import uk.co.shastra.hydra.messaging.TransportMessage;
import uk.co.shastra.hydra.messaging.messageids.MessageId;
import uk.co.shastra.hydra.messaging.storage.Store;
import uk.co.shastra.hydra.messaging.utils.ListUtils;
public class MultiFetcher implements MessageFetcher {
private MessageFetcher[] fetchers;
public MultiFetcher(MessageFetcher... fetchers)
{
this.fetchers = fetchers;
}
@Override
public Iterable messagesAfterIdUpToSeq(Store store, MessageId startId, long lastSeq) {
ArrayList> messageLists = new ArrayList>();
for (MessageFetcher fetcher : fetchers) {
messageLists.add(fetcher.messagesAfterIdUpToSeq(store, startId, lastSeq));
}
return ListUtils.Merge(messageLists);
}
@Override
public Iterable messagesInSet(Store store, Iterable messageIds) {
ArrayList> messageLists = new ArrayList>();
for (MessageFetcher fetcher : fetchers) {
messageLists.add(fetcher.messagesInSet(store, messageIds));
}
return ListUtils.Merge(messageLists);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy