Package jade.core.messaging

Examples of jade.core.messaging.GenericMessage


   
    public final boolean accept(VerticalCommand cmd) {
      String name = cmd.getName();
      if (name.equals(MessagingSlice.SEND_MESSAGE)) {
        AID sender = (AID) cmd.getParam(0);
        GenericMessage gMsg = (GenericMessage) cmd.getParam(1);
        AID receiver = (AID) cmd.getParam(2);
       
        if (TopicUtility.isTopic(receiver)) {
          // This message is directed to a Topic
          AID topic = receiver;
          if (myLogger.isLoggable(Logger.FINE)) {
            myLogger.log(Logger.FINE, "Handling message about topic "+topic.getLocalName());
          }
          ACLMessage msg = gMsg.getACLMessage();
          Collection interestedAgents = topicTable.getInterestedAgents(topic, msg);
          if (interestedAgents.size() > 0) {
            // Forward the message to all agents interested in that topic.
            // Note that if no agents are currently listening to this topic, the message is simply swallowed
            msg.addUserDefinedParameter(ACLMessage.IGNORE_FAILURE, "true");
            gMsg.setModifiable(false);
            Iterator it = interestedAgents.iterator();
            while (it.hasNext()) {
              AID target = (AID) it.next();
              if (myLogger.isLoggable(Logger.FINE)) {
                myLogger.log(Logger.FINE, "Forwarding message to agent "+target.getName());
View Full Code Here


        toBeSent = (ACLMessage) msg.clone();
      }
      else {
        toBeSent = msg;
      }
      GenericMessage gmsg = new GenericMessage(toBeSent);
      cmd.addParam(gmsg);
      cmd.addParam(receiver);
      // Set the credentials of the sender
      initCredentials(cmd, sender);
      Object ret = myCommandProcessor.processOutgoing(cmd);
View Full Code Here

  }

  private GenericMessage deserializeGenericMessage() throws IOException, LEAPSerializationException {
    byte[] payload = deserializeByteArray();   
    Envelope env = (Envelope) readObject();
    GenericMessage gm = new GenericMessage(env, payload);
    gm.setAMSFailure(readBoolean());
    gm.setTraceID((String) readObject());
    return gm;
  }
View Full Code Here

TOP

Related Classes of jade.core.messaging.GenericMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.