Package net.sf.eBus.config
Class EConfigure.MulticastConnection
- java.lang.Object
-
- net.sf.eBus.config.EConfigure.MulticastConnection
-
- Enclosing class:
- EConfigure
public static final class EConfigure.MulticastConnection extends Object
AMulticastConnectioninstance is used to create anet.sf.eBus.client.EMulticastConnectionand contains all the settings which define a multicast connection. The JSON properties are:Multicast JSON Properties Property Required? Type Default Description nameYes StringNA Unique multicast connection name. Used for logging purposes only but must be provided and must be unique within the application instance. roleYes EConfigure.MulticastRoleNA Specifies whether this is a publisher or subscriber multicast connection. groupYes InetAddressNA Multicast group address. targetPortYes int> zero and < 65,536.NA Send datagram packets to the multicast group on this port. notificationsYes Array of EConfigure.McastNotifyConfigNA Notification message keys used to create net.sf.eBus.client.EMultiFeedinstances.networkInterfaceYes NetworkInterfaceNA Local interface used to receive multicast datagram packets. sourcesNo Array of InetAddressEmpty list. Multicast packets are accepted only from those addresses contained in the sourceslist. If an empty list then packets are accepted from any source.bindPortNo int≥ zero and < 65,536.ENetConfigure.ANY_PORTBind the socket's local side to the given port. protocolFamilyYes StandardProtocolFamilyNA Specifies whether the datagram channel is opened using IPv4 or IPv6. byteOrderNo ByteOrderEConfigure.DEFAULT_BYTE_ORDERNotifications posted to the multicast group are encoded in this byte ordering. selectorNo StringENetConfigure.defaultSelector()Multicast socket is monitored by this named selector thread. inputBufferSizeNo int> zeroENetConfigure.DEFAULT_BUFFER_SIZESize of inbound socket ByteBufferin bytes. Defines maximum allowed size of encoded messages.outputBufferSizeNo int> zeroENetConfigure.DEFAULT_BUFFER_SIZESize of outbound socket ByteBufferin 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InetAddressbindAddress()Returns the address to which the local socket side is bound.intbindPort()Returns port to which local socket side is bound.ByteOrderbyteOrder()Returns byte order in which messages are encoded and decoded.InetAddressgroup()Returns multicast group address.InetSocketAddressgroupAddress()Socket address containing the {link #group()} andtargetPort().intinputBufferSize()Inbound, encoded messages are copied into aByteBufferof this size (in bytes).Stringname()Returns unique multicast connection name.NetworkInterfacenetworkInterface()Returns network interface associated with the multicast group address.List<EConfigure.McastNotifyConfig>notifications()Returns notification message keys which are either posted to or received from the multicast group depending on the role.intoutputBufferSize()Outbound message are encoded into aByteBufferof this size (in bytes).ProtocolFamilyprotocolFamily()Returns multicast group protocol family.EConfigure.MulticastRolerole()Returns multicast connection role which is either publisher or subscriber.Stringselector()Returns selector thread used to monitor this multicast connection.List<InetAddress>sources()Returns the optional source address list.inttargetPort()Returns multicast target port.StringtoString()Returns text containing the multicast connection configuration.
-
-
-
Method Detail
-
toString
public String toString()
Returns text containing the multicast connection configuration.
-
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 forpostingmessages to the multicast group.- Returns:
- multicast target port.
-
groupAddress
public InetSocketAddress groupAddress()
Socket address containing the {link #group()} andtargetPort().- 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 returnnull. If notnullor 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 returnnull.- Returns:
- local socket side bind address.
-
bindPort
public int bindPort()
Returns port to which local socket side is bound. IfENetConfigure.ANY_PORTis 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 aByteBufferof this size (in bytes).- Returns:
- buffer size in bytes.
-
outputBufferSize
public int outputBufferSize()
Outbound message are encoded into aByteBufferof 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.
-
-