Class EConfigure.MulticastConnection

  • Enclosing class:
    EConfigure

    public static final class EConfigure.MulticastConnection
    extends Object
    A MulticastConnection instance is used to create a net.sf.eBus.client.EMulticastConnection and contains all the settings which define a multicast connection. The JSON properties are:
    Multicast JSON Properties
    Property Required? Type Default Description
    name Yes String NA Unique multicast connection name. Used for logging purposes only but must be provided and must be unique within the application instance.
    role Yes EConfigure.MulticastRole NA Specifies whether this is a publisher or subscriber multicast connection.
    group Yes InetAddress NA Multicast group address.
    targetPort Yes int > zero and < 65,536. NA Send datagram packets to the multicast group on this port.
    notifications Yes Array of EConfigure.McastNotifyConfig NA Notification message keys used to create net.sf.eBus.client.EMultiFeed instances.
    networkInterface Yes NetworkInterface NA Local interface used to receive multicast datagram packets.
    sources No Array of InetAddress Empty list. Multicast packets are accepted only from those addresses contained in the sources list. If an empty list then packets are accepted from any source.
    bindPort No int ≥ zero and < 65,536. ENetConfigure.ANY_PORT Bind the socket's local side to the given port.
    protocolFamily Yes StandardProtocolFamily NA Specifies whether the datagram channel is opened using IPv4 or IPv6.
    byteOrder No ByteOrder EConfigure.DEFAULT_BYTE_ORDER Notifications posted to the multicast group are encoded in this byte ordering.
    selector No String ENetConfigure.defaultSelector() Multicast socket is monitored by this named selector thread.
    inputBufferSize No int > zero ENetConfigure.DEFAULT_BUFFER_SIZE Size of inbound socket ByteBuffer in bytes. Defines maximum allowed size of encoded messages.
    outputBufferSize No int > zero ENetConfigure.DEFAULT_BUFFER_SIZE Size of outbound socket ByteBuffer in bytes.

    Example multicast connection.

    name : mc1
    role : PUBLISHER
    group : "225.4.5.6"
    targetPort : 12358
    networkInterface : en5
    sources : []
    bindPort : 5000
    protocolFamily : INET
    byteOrder : LITTLE_ENDIAN
    selector : s1
    inputBufferSize : 512
    outputBufferSize : 512
    
    notifications : [ ... ]

    A multicast connection is configured to either publish notification messages to the group or subscribe to notification messages. A multicast connection cannot both publish and subscribe to the same group. That said, an application may have separate multicast connections: one for publishing and one for subscribing. It is not recommended that an application have more than one multicast group connection with the same role and message keys as this results in needless encoding/decoding effort. It will also result in the same notification being published multiple times.

    Note that multicast connections do not support request/reply messages.

    See Also:
    EConfigure.MulticastBuilder
    • Method Detail

      • toString

        public String toString()
        Returns text containing the multicast connection configuration.
        Overrides:
        toString in class Object
        Returns:
        multicast connection configuration as text.
      • name

        public String name()
        Returns unique multicast connection name. This name is used for logging purposes only.
        Returns:
        multicast connection name.
      • role

        public EConfigure.MulticastRole role()
        Returns multicast connection role which is either publisher or subscriber.
        Returns:
        multicast connection role.
      • group

        public InetAddress group()
        Returns multicast group address.
        Returns:
        multicast group address.
      • targetPort

        public int targetPort()
        Returns multicast target port. This port is used for posting messages to the multicast group.
        Returns:
        multicast target port.
      • groupAddress

        public InetSocketAddress groupAddress()
        Socket address containing the {link #group()} and targetPort().
        Returns:
        Socket address containing the multicast group address and port.
      • networkInterface

        public NetworkInterface networkInterface()
        Returns network interface associated with the multicast group address.
        Returns:
        multicast group network interface.
      • sources

        public List<InetAddress> sources()
        Returns the optional source address list. May return null. If not null or empty, datagram packets are accepted only from the listed addresses; otherwise packets are accepted from any source.
        Returns:
        source address list. May be null.
      • bindAddress

        public InetAddress bindAddress()
        Returns the address to which the local socket side is bound. May return null.
        Returns:
        local socket side bind address.
      • bindPort

        public int bindPort()
        Returns port to which local socket side is bound. If ENetConfigure.ANY_PORT is returned then local side is bound to an ephemeral port.
        Returns:
        local socket side bind port.
      • protocolFamily

        public ProtocolFamily protocolFamily()
        Returns multicast group protocol family.
        Returns:
        multicast group protocol family.
      • byteOrder

        public ByteOrder byteOrder()
        Returns byte order in which messages are encoded and decoded.
        Returns:
        message encoding, decoding byte order.
      • selector

        public String selector()
        Returns selector thread used to monitor this multicast connection.
        Returns:
        selector thread name.
      • inputBufferSize

        public int inputBufferSize()
        Inbound, encoded messages are copied into a ByteBuffer of this size (in bytes).
        Returns:
        buffer size in bytes.
      • outputBufferSize

        public int outputBufferSize()
        Outbound message are encoded into a ByteBuffer of this size (in bytes).
        Returns:
        buffer size in bytes.
      • notifications

        public List<EConfigure.McastNotifyConfig> notifications()
        Returns notification message keys which are either posted to or received from the multicast group depending on the role.
        Returns:
        notification message keys set.