Class ZeroconfDiscoveryAgent

java.lang.Object
org.apache.activemq.transport.discovery.zeroconf.ZeroconfDiscoveryAgent
All Implemented Interfaces:
EventListener, javax.jmdns.ServiceListener, Service, DiscoveryAgent

public class ZeroconfDiscoveryAgent extends Object implements DiscoveryAgent, javax.jmdns.ServiceListener
A DiscoveryAgent using Zeroconf via the jmDNS library
  • Constructor Details

    • ZeroconfDiscoveryAgent

      public ZeroconfDiscoveryAgent()
  • Method Details

    • start

      public void start() throws Exception
      Specified by:
      start in interface Service
      Throws:
      Exception
    • stop

      public void stop()
      Specified by:
      stop in interface Service
    • registerService

      public void registerService(String name) throws IOException
      Description copied from interface: DiscoveryAgent
      register a service
      Specified by:
      registerService in interface DiscoveryAgent
      Throws:
      IOException
    • addService

      public void addService(javax.jmdns.JmDNS jmDNS, String type, String name)
    • removeService

      public void removeService(javax.jmdns.JmDNS jmDNS, String type, String name)
    • serviceAdded

      public void serviceAdded(javax.jmdns.ServiceEvent event)
      Specified by:
      serviceAdded in interface javax.jmdns.ServiceListener
    • serviceRemoved

      public void serviceRemoved(javax.jmdns.ServiceEvent event)
      Specified by:
      serviceRemoved in interface javax.jmdns.ServiceListener
    • serviceResolved

      public void serviceResolved(javax.jmdns.ServiceEvent event)
      Specified by:
      serviceResolved in interface javax.jmdns.ServiceListener
    • resolveService

      public void resolveService(javax.jmdns.JmDNS jmDNS, String type, String name, javax.jmdns.ServiceInfo serviceInfo)
    • getPriority

      public int getPriority()
    • setPriority

      public void setPriority(int priority)
    • getWeight

      public int getWeight()
    • setWeight

      public void setWeight(int weight)
    • getJmdns

      public javax.jmdns.JmDNS getJmdns() throws IOException
      Throws:
      IOException
    • setJmdns

      public void setJmdns(javax.jmdns.JmDNS jmdns)
    • getLocalAddress

      public InetAddress getLocalAddress() throws UnknownHostException
      Throws:
      UnknownHostException
    • setLocalAddress

      public void setLocalAddress(InetAddress localAddress)
    • getLocalhost

      public String getLocalhost()
    • setLocalhost

      public void setLocalhost(String localhost)
    • createServiceInfo

      protected javax.jmdns.ServiceInfo createServiceInfo(String name, Map map)
    • createJmDNS

      protected javax.jmdns.JmDNS createJmDNS() throws IOException
      Throws:
      IOException
    • createLocalAddress

      protected InetAddress createLocalAddress() throws UnknownHostException
      Throws:
      UnknownHostException
    • setDiscoveryListener

      public void setDiscoveryListener(DiscoveryListener listener)
      Description copied from interface: DiscoveryAgent
      Sets the discovery listener
      Specified by:
      setDiscoveryListener in interface DiscoveryAgent
    • getGroup

      public String getGroup()
    • setGroup

      public void setGroup(String group)
    • setType

      public void setType(String typeSuffix)
    • getType

      public String getType()
    • serviceFailed

      public void serviceFailed(DiscoveryEvent event) throws IOException
      Description copied from interface: DiscoveryAgent
      A process actively using a service may see it go down before the DiscoveryAgent notices the service's failure. That process can use this method to notify the DiscoveryAgent of the failure so that other listeners of this DiscoveryAgent can also be made aware of the failure.
      Specified by:
      serviceFailed in interface DiscoveryAgent
      Throws:
      IOException