Menu

Starting a Service

AFME
2009-11-22
2013-03-03
  • Sree Aurovindh Viswanathan

    Dear Dr.Conor,

    I had written the complete segment of code during my two day vacation in between my exams.i would like to clarify a few things here.

    The code segment that i have written runs without any bug.However the service does not start by itself neither could i start the service.For instance ,

    In the AFME programmers guide you have started a service PeerToPeerMTS with the arguments which is taken inside the program as commandline arguments.

    I have written a similar code called PeerToPeerSpotMTS however to my dismay the service doesn't start.I have done the following steps for it to work

    I have extended the service class and have overridden the needed methods for it to work with.However even when i call it inside my Code as you have mentioned it in the (AFME Programmers guide documentation). it doesn't seem to work

    Please do let me know if i need to take any additional steps in order to resolve this issue.Thanks for your help in advance

    Sree aurovindh.V

     
  • Conor

    Conor - 2009-11-24

    Hi Sree,

    The PeerToPeerMTS does not take arguments from the command line. The arguments are specified in the agent platform script. When you make a change to the platform script, you must recompile it using the AFME compiler. Make sure that you specify the extended class in the script. Once the script has been recompiled, if you are using an IDE, you must make sure that you refresh the folder so as that the IDE has detected the code that was generated.

    Conor

     
  • Sree Aurovindh Viswanathan

    Dear Dr.Conor,

    I could now run the service and sorry that I have misinterpreted that all the arguments that are passed in the agentfactory(*.af) file is taken inside the constructor of the class (com.agentfactory.cldc.p2pmts.PeerToPeerMTS) in args  parameter of it. However I have few doubts regarding the service

    For instance, if a service is called using the below syntax in agentfactory(*.af) file

    service com.agentfactory.cldc.p2pmts.PeerToPeerMTS mts DiscReg unblocked 9999 “socket://navaman.ucd.ie:11000”

    Then inside the PeerToPeerMTS class how these parameters could be accessed.When I refered to the generated java file(by afme compiler) I could see that the segment below

            final AgentName agentName=new AgentName;
          
            //Service service;
            String args=null;
           
        args=new String;
            args="mts";
            args="BobSpotClient";
            args="unblocked";
            args="200";
            args="Bob";
            args="BobSpot.BobSpotDesign";
            args="1000";
    new com.agentfactory.cldc.mts.p2pspot.PeerToPeerSpotMTS(args,agentName,scheduler,this).register(services);
           

    I could identify what the arguments above mean but what about ‘socket://navanman.ucd.ie:11000” how to access this And further how does these arguments gets assigned to the generated file. Is there any other way to specify what has to be generated by the compiler (And I am sorry that I have not referred to how the code is generated..

    basically i am trying to use the parameter "socket://navm.ucd.ie:1000" in the constructor.I am trying to find a way to get that parameter which was passed from the af file.Please help me in this regard

    Thanks and Regards

    Sree Aurovindh.V

     
  • Conor

    Conor - 2009-11-27

    hi Sree,

    I think you are missing a semi colon and a create in the script. It should be something like the following:

    service com.agentfactory.cldc.p2pmts.PeerToPeerMTS mts DiscReg unblocked 9999 “socket://navaman.ucd.ie:11000”;

    create Bob BobSpot.BobSpotDesign 1000;

    The compiler just treats anything within quotes as literals and removes the quates in the generated code. That is, socket://navaman.ucd.ie:11000 will be passed as an argument in the usual manner.

    Best regards,
    Conor

     

Log in to post a comment.

Auth0 Logo