0

I am currently working on a task which includes actions on jade agent like agent suspend , agent kill etc . Where i get jade agent name from web services . How will i get agent id or agent object from agent name?

public class DPM_MainAgent_WebService_Worker extends Agent {
    AMSAgentDescription[] agents = null;
    protected void setup() 
    {        

     AID aid = new AID("FirstAgent",true);
     System.out.println("aid::::::::"+aid);

    }

}

FirstName is my agent local name which i am able to get from webservices. I am able to get AID object. But my need is to get agent object. How can i achieve this?

Thanks

  • Plz help with the code reference – Nik Varma Aug 17 '16 at 07:27
  • I have edited my question @NikVarma .. – Lavanya Rani Aug 19 '16 at 06:19
  • still have not understand your quest, hope the url helpful for you https://www.iro.umontreal.ca/~vaucher/Agents/Jade/primer4.html – Nik Varma Aug 19 '16 at 06:27
  • I have a web service receiver class called DPM_MainAgent_WebService_Worker which will receive ACL message from WebService . In this web service will be sending agent name and agent action to DPM_MainAgent_WebService_Worker , where i need to perform agent actions with the agent name. To perform agent actions i need agent object. I am not able to achieve agent object of other agent in my DPM_MainAgent_WebService_Worker . @NikVarma – Lavanya Rani Aug 25 '16 at 11:05

1 Answers1

0

There are several questions here :

  1. "How will i get agent id or agent object from agent name ?"

Assuming that the agent you are referring to is on your platform, you can recreate the agent ID (AID) from the (local)name of your agent buy doing this :

new AID("YourAgentName", AID.ISLOCALNAME)

Indeed, and Agent identifier (AID) = localName + ID of the platform

  1. "my need is to get agent object. How can i achieve this?"

The ref to an agent "object" is easily obtained when you create it. You can thus store them somewhere (like a Map < AgentName,AgentRef >). But generally speaking, it is not recommanded to manipulate agents references as they are thread and may migrate. In most cases its better to ask them to do what you want through messages. Otherwise they are only objects, not agents ;)

Hc.
  • 86
  • 4