Class ReplicatedMessageQueueAgent
- java.lang.Object
- 
- jadex.micro.examples.messagequeue.replicated.ReplicatedMessageQueueAgent
 
- 
- All Implemented Interfaces:
- IMessageQueueService,- IMessageQueueReplicableService,- IMessageQueueReplicationService
 
 public class ReplicatedMessageQueueAgent extends java.lang.Object implements IMessageQueueReplicableService, IMessageQueueReplicationService This agent represents a part of a distributed, replicable message queue. It offers a message queue service that is used by the local clients. Also it offers and uses a remote message queue service where other remote services can subscribe to receive and distribute messages from local clients.
- 
- 
Field SummaryFields Modifier and Type Field Description protected IInternalAccessagentThe agent.protected java.lang.StringidThe service idprotected java.util.Map<java.lang.String,java.util.List<SubscriptionIntermediateFuture<Event>>>localsubscribersThe map of local subscribers.protected java.util.Map<java.lang.String,java.util.List<SubscriptionIntermediateFuture<Event>>>repsubscribersThe map of the replication subscribers.protected java.util.Map<java.lang.String,java.util.List<ReplicationSubscription>>repsubscriptionsThe map ofReplicationSubscriptionsprotected java.lang.IntegersearchintervalThe search interval argument.
 - 
Constructor SummaryConstructors Constructor Description ReplicatedMessageQueueAgent()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidagentBody()voidagentCreated()Called on agent creation.java.lang.StringgetIdString()Returns the services unique Id.IFuture<java.lang.Void>publish(java.lang.String topic, Event event)Publish a new event to the queue.IFuture<java.lang.Void>publish(java.lang.String topic, Event event, java.lang.Boolean replicate)Publish a new event to the queue.ISubscriptionIntermediateFuture<Event>subscribe(java.lang.String topic)Subscribe to a specific topic.ISubscriptionIntermediateFuture<Event>subscribeForReplication(java.lang.String topic)Subscribe to a specific topic.
 
- 
- 
- 
Field Detail- 
agentprotected IInternalAccess agent The agent.
 - 
localsubscribersprotected java.util.Map<java.lang.String,java.util.List<SubscriptionIntermediateFuture<Event>>> localsubscribers The map of local subscribers.
 - 
repsubscribersprotected java.util.Map<java.lang.String,java.util.List<SubscriptionIntermediateFuture<Event>>> repsubscribers The map of the replication subscribers.
 - 
repsubscriptionsprotected java.util.Map<java.lang.String,java.util.List<ReplicationSubscription>> repsubscriptions The map ofReplicationSubscriptions
 - 
idprotected java.lang.String id The service id
 - 
searchintervalprotected java.lang.Integer searchinterval The search interval argument.
 
- 
 - 
Method Detail- 
agentCreatedpublic void agentCreated() Called on agent creation.
 - 
agentBodypublic void agentBody() 
 - 
subscribeForReplicationpublic ISubscriptionIntermediateFuture<Event> subscribeForReplication(java.lang.String topic) Subscribe to a specific topic. New events that fit to the topic are forwarded to all replication subscribers as intermediate results. A subscribe can unsubscribe by terminating the future.- Specified by:
- subscribeForReplicationin interface- IMessageQueueReplicationService
- Parameters:
- topic- The topic.
- Returns:
- The events.
 
 - 
subscribepublic ISubscriptionIntermediateFuture<Event> subscribe(java.lang.String topic) Subscribe to a specific topic. New events that fit to the topic are forwarded to all subscribers as intermediate results. A subscribe can unsubscribe by terminating the future. Every time when someone subscribe for local messages the server also subscribe for the given topic by all the other remote services.- Specified by:
- subscribein interface- IMessageQueueService
- Parameters:
- topic- The topic.
- Returns:
- The events.
 
 - 
publishpublic IFuture<java.lang.Void> publish(java.lang.String topic, Event event, java.lang.Boolean replicate) Publish a new event to the queue.- Specified by:
- publishin interface- IMessageQueueReplicableService
- Parameters:
- topic- The topic.
- event- The event to publish.
- replicate- Should the event be replicated among all message queues?
 
 - 
publishpublic IFuture<java.lang.Void> publish(java.lang.String topic, Event event) Publish a new event to the queue.- Specified by:
- publishin interface- IMessageQueueService
- Parameters:
- topic- The topic.
- event- The event to publish.
 
 - 
getIdStringpublic java.lang.String getIdString() Returns the services unique Id.- Specified by:
- getIdStringin interface- IMessageQueueReplicationService
- Returns:
- the service Id.
 
 
- 
 
-