Class JBus

java.lang.Object
javaforce.bus.JBus
All Implemented Interfaces:
EndPoint
Direct Known Subclasses:
JBusClient, JBusServer

public class JBus extends Object implements EndPoint
  • Field Details

    • options

      public DBus.Options options
      DBus options that must be configured before connect().
  • Constructor Details

    • JBus

      public JBus(String name, Object obj)
      Create a JBus instance.
      Parameters:
      name - = bus name (null = client)
      obj - = object with RPC methods
  • Method Details

    • setDispatch

      public void setDispatch(Dispatch dispatch)
      Setup alternative message dispatch.
    • getEndPointName

      public String getEndPointName()
      Returns bus name
      Specified by:
      getEndPointName in interface EndPoint
      Returns:
      End Point name (null to request system supplied name)
    • dispatch

      public Object dispatch(String method, Object[] args) throws Exception
      Dispatches inbound method call.
      Specified by:
      dispatch in interface EndPoint
      Parameters:
      method - = method invoked
      args - = arguments
      Returns:
      method return value or null if error
      Throws:
      Exception
    • invoke

      public Object invoke(String dest, String method, Object... args)
      Invoke a method on another member on the message bus.
    • signal

      public Object signal(String dest, String method, Object... args)
      Invoke a method on all clients that have subscribed to method.
    • subscribe

      public boolean subscribe(String sender, String method)
      Subscribe to a signal from another client.
    • unsubscribe

      public boolean unsubscribe(String sender, String method)
      Unsubscribe to a signal from another client.
    • getBusName

      public String getBusName()
      Returns bus name requested or assigned.
    • setTimeout

      public void setTimeout(int ms)
      Set DBus timeout.
    • connect

      public boolean connect()
      Connect to message bus.
    • disconnect

      public void disconnect()
      Closes connection to message bus.