Open topic with navigation

TIBCO® Enterprise Administrator 2.4.2

# Receive Agent Registration Notifications

An agent can store the server URL which is used to register itself with the TIBCO Enterprise Administrator server. This is especially useful when you have a failover mechanism in place. When the secondary agent comes up, the agent can use the URL information that is stored to register with TIBCO Enterprise Administrator.

The agent must implement the TeaAgentRegistrationListener interface to send the URL information from the TIBCO Enterprise Administrator server to the agent.

    public interface TeaAgentRegistrationListener
    extends EventListener{
    void onAgentRegistered(TeaServerInfo event);
    }

## Sample Code that Implements TeaAgentRegistrationListener

The following is a sample code snippet that shows how a standalone agent API adds the AgentRegistrationListener. It is assumed that you have created an instance of TeaAgentServer as follows:

    TeaAgentServer server = new TeaAgentServer("HelloWorldAgent", "1.1",
    "Hello World Agent", 1234, "/helloworldagent", true);

    //Add AgentRegistrationListener to the server.
    server.addEventListener(new SampleAgentRegistrationListener());

The following is a sample code snippet that shows how a servlet API adds the AgentRegistrationListener. It is assumed that SampleTeaAgentServlet extends TeaAgentServlet and you have an instance of it.

    SampleTeaAgentServlet servlet = new SampleTeaAgentServlet();

    //Add AgentRegistrationListener to servlet
    servlet.addEventListener(new SampleAgentRegistrationListener());

The following class implements TeaAgentRegistrationListener:

    import com.tibco.tea.agent.api.TeaAgentRegistrationListener;
    import com.tibco.tea.agent.api.TeaServerInfo;

    public class SampleAgentRegistrationListener implements TeaAgentRegistrationListener {

    @Override
    public void onAgentRegistered(TeaServerInfo serverInfo) {
     System.out.println("TeaServerInfo Event Tea Server URL :" + serverInfo.getServerUrl()); }

    }

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO® Enterprise Administrator

Copyright © 1996-2025. Cloud Software Group, Inc. All Rights Reserved.