All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.co.shastra.hydra.messaging.messagefetchers.HydraByTopicMessageFetcher Maven / Gradle / Ivy

Go to download

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 org.ektorp.ComplexKey;

import uk.co.shastra.hydra.messaging.HydraMessage;
import uk.co.shastra.hydra.messaging.messageids.MessageId;

public class HydraByTopicMessageFetcher extends MessageFetcherBase {

	private String topic;
	private ComplexKey endKey;
    
	public HydraByTopicMessageFetcher(String topic) {
		super(HydraMessage.class);
		this.topic = topic;
		// TODO - check that "{}" is a suitable max value
		endKey = ComplexKey.of(topic, ComplexKey.emptyObject());
	}

	@Override
	protected String getViewName() { return "broadcastMessages"; }

    // The broadcastMessages view is indexed on [topic, id]
	@Override
	protected ComplexKey getMessageKey(MessageId id) { return ComplexKey.of(topic, id.toDocId()); }

	@Override
	protected ComplexKey getEndKey() { return endKey; }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy