Class MessageQueueAgent

java.lang.Object
jadex.micro.messagequeue.MessageQueueAgent
All Implemented Interfaces:
IMessageQueueService

public class MessageQueueAgent extends Object implements IMessageQueueService
This agent represents the central message queue. It offers a message queue service that is used by the clients.
  • Field Details

    • agent

      protected jadex.core.IComponent agent
      The agent.
    • subscribers

      protected Map<String,List<jadex.future.SubscriptionIntermediateFuture<Event>>> subscribers
      The map of subscribers.
  • Constructor Details

    • MessageQueueAgent

      public MessageQueueAgent()
  • Method Details

    • agentCreated

      public void agentCreated()
      Called on agent creation.
    • subscribe

      public jadex.future.ISubscriptionIntermediateFuture<Event> subscribe(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.
      Specified by:
      subscribe in interface IMessageQueueService
      Parameters:
      topic - The topic.
      Returns:
      The events.
    • publish

      public jadex.future.IFuture<Void> publish(String topic, Event event)
      Publish a new event to the queue.
      Specified by:
      publish in interface IMessageQueueService
      Parameters:
      topic - The topic.
      event - The event to publish.