Class EConfigure
- java.lang.Object
-
- net.sf.eBus.config.EConfigure
-
public final class EConfigure extends Object
This immutable class contains eBus services, remote connection, dispatcher, and pause configuration. This configuration can be specified:-
By building
EConfigure.ServiceandEConfigure.RemoteConnectioninstances and passing these objects toEServer.configure(EConfigure)andERemoteApp.configure(EConfigure), respectively.EConfigure.Dispatcherhas a private constructor and cannot be instantiated by the application. -
Creating individual
EConfigure.ServiceandEConfigure.RemoteConnectioninstances and passing the instance toEServer.openServerorERemoteApp.openConnection, respectively. This allows for finer-grained control over services and connections. - From typesafe JSON-based configuration file.
NOTE:As of eBus release 6.0.0,
Properites-based configuration is no longer supported. Please move to typesafe-based configuration.Please note that eBus configuration requires no service or connections to be specified. If this is the case, remote connections are neither accepted nor established and all messages flow between objects within the JVM.
eBus release 4.7.0 supports secure TCP connections based on SSL/TLS using
SSLContext. eBus release 6.0.0 supports secure UDP "connections" based on DTLS. These connection types are not supported using a configuration file as this would require placing sensitive information in an insecure manner. Therefore, creating secure TCP services and connections can only be done using the API.Dispatcher threads are instantiated on JVM start-up, the dispatcher configuration is taken from the properties file specified by the command line parameter
-Dnet.sf.eBus.config.jsonFile=<typesafe json file path>. eBus loads theEClientDispatcherconfiguration from this properties file and creates the dispatcher threads according to this configuration. If no configuration file is specified or is incorrectly configured, eBus defaults to a single, blocking run queue. The run queue thread count equalsRuntime.availableProcessors().The eBus configuration uses the following JSON properties. See typesafe project for a thorough explanation of typesafe JSON configuration file layout. As of eBus v. 5.1.0, eBus connections may be paused which is described in detail here.
SeeTop-level JSON Properties Property Required? Type Default Description servicesNo Array of EConfigure.Serviceinstances.No eBus services. Contains eBus services. May be an empty array. connectionsNo Array of EConfigure.RemoteConnectioninstances.No eBus remote connections. Contains eBus remote connections. May be an empty array. multicastNo Array of EConfigure.MulticastConnectioninstances.No eBus multicast notifications. Contains eBus multicast connections. May be an empty array. dispatchersNo. Array of EConfigure.Dispatcherinstances.Default eBus blocking dispatcher with Thread.NORM_PRIORITYandDEFAULT_QUANTUMand thread count based on the number of available processors.Contains eBus dispatcher definitions. May be an empty array. selectorsNo Array of ENetConfigure.SelectorInfoinstances.Contains eBus NIO selector thread definitions. May be an empty array. EConfigure.Dispatcherfor information about two special, pre-definedDispatchertypes:EConfigure.DispatcherType.SWINGandEConfigure.DispatcherType.JAVAFXwhich deliver eBus messages via the GUI thread.See the eBus overview section on connecting eBus applications for a detailed description in configuring eBus connections.
Connection Pause
eBus release 5.1.0 introduces the ability to automatically pause a connection when it has been idle or continuously connected for a given time. When paused, messages are kept on a backlog for later transmission when the connection is resumed. The message backlog queue size may be limited. Once the queue size reaches that limit, then messages are discarded based on the specified discard policy.
The connection is resumed when the pause time is reached. This pause time is always used. Optionally a resume-on-backlog-size may also be set. When the backlog size reaches this size while paused, the connection is resumed even if the pause time is not yet reached.
The connection pause time and maximum backlog size are negotiated between the two connection ends. The lesser pause time and backlog size values are used by both ends.
This feature is added with an eye towards mobile devices which cannot support keeping connections up for an extended time due to battery limitations.
eBus JSON Configuration
eBus now supports typesafe JSON configuration. This represents a subset of JSON known as HOCON (Human-Optimized Config Object Notation). The following is an eBus configuration in HOCON. Going forward typesafe HOCON will be the preferred method for configuring eBus with
java.util.Propertiesbeing deprecated.selectors : [ { name : selector1 type : "spin+park" isDefault : true priority : 7 spinLimit : 1000000 parkTime : 500ns } ] services : [ { name : service1 // Defaults to TCP connection type. port : 12345 addressFilter : [ "127.0.0.1", "127.0.0.1:54321" ] serviceSelector : selector1 connectionSelector : selector1 byteOrder : LITTLE_ENDIAN inputBufferSize : 8192 outputBufferSize : 65536 messageQueueSize : 100 canPause : true // Connection pause/resume configuration. pause : { pauseTime : 10m maxBacklogSize : 50 } } ] connections : [ { name : conn1 host : "127.0.0.1" port : 12346 bindPort : 0 byteOrder : BIG_ENDIAN selector : selector1 inputBufferSize : 8192 outputBufferSize : 65536 messageQueueSize : 100 reconnect : true reconnectTime : 500ms canPause : true // Connection pause/resume configuration. pause : { pauseTime : 5m maxBacklogSize : 100 discardPolicy : YOUNGEST_FIRST idleTime : 1m maxConnectTime : 2m resumeOnBacklogSize : 10 } } ] dispatchers : [ { name : d1 runQueueType : "spin+park" spinLimit : 2500000 parkTime : 500ns isDefault : true priority : 5 quantum : 10000ns numberThreads : 4 } ]- Author:
- Charles Rapp
- See Also:
ENetConfigure
-
By building
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEConfigure.AbstractBuilder<T extends EConfigure.AbstractBuilder>Base class forEConfigure.ServerBuilderandEConfigure.ConnectionBuilder, containing the properties common to both.static classEConfigure.AbstractConfigBase class for service and remote connections.static classEConfigure.ConnectionBuilderConstructs anEConfigure.RemoteConnectioninstance based on the parameters set via the builder's API.static classEConfigure.ConnectionRoleDefines remote connection side, either acceptor or initiator.static classEConfigure.ConnectionTypeEnumerates the channel types supported by eBusERemoteApp.static classEConfigure.DiscardPolicyWhen a connection is paused and the server message backlog breaches the maximum allowed message backlog limit, this policy specifies which messages should be discarded to keep the backlog at the limit.static classEConfigure.DispatchereBus uses aDispatcherto forward messages to client.static classEConfigure.DispatcherBuilderConstructs anEConfigure.Dispatcherconfiguration instance based on the parameters set via the builder's API.static classEConfigure.DispatcherTypeEnumerates the supported eBus dispatcher thread types.static classEConfigure.McastNotifyBuilderBuilder used to createEConfigure.McastNotifyConfiginstances.static classEConfigure.McastNotifyConfigContains the notification message class and subject(s) which defines the messages either published by aEConfigure.MulticastConnectionor subscribed to.static classEConfigure.MessageCompilerTypeDefines supported eBus message compilers.static classEConfigure.MulticastBuilderBuilder used to created aEConfigure.MulticastConnectionconnection instance.static classEConfigure.MulticastConnectionAMulticastConnectioninstance is used to create anet.sf.eBus.client.EMulticastConnectionand contains all the settings which define a multicast connection.static classEConfigure.MulticastRoleMulticast connections are used to transmit notification messages only.static classEConfigure.MultifeedTypeA multi-feed uses either a fixed list of subjects or a subject query.static classEConfigure.PauseBuilderConstructs aEConfigure.PauseConfiginstance based on the parameters set via the builder API.static classEConfigure.PauseConfigIf a remote connection is to be paused, then this is the allowed pause configuration.static classEConfigure.RemoteConnectionThis immutable class stores the information pertaining to a remote eBus connection.static classEConfigure.ServerBuilderConstructs anEConfigure.Serviceinstance based on the parameters set via this builder's API.static classEConfigure.ServiceThis immutable class stores the configuration for an eBus service.
-
Field Summary
Fields Modifier and Type Field Description static StringBIND_HOST_KEYThe connection definition uses the "bindHost" key suffix.static StringBIND_PORT_KEYThe connection definition uses the "bindPort" key suffix.static StringBYTE_ORDER_KEYBoth the service and connection definitions use the "byteOrder" key suffix.static StringCAN_PAUSE_KEYIf a remote client connection may be paused, then this property is defined and set totrue.static StringCLASSES_KEYThe key "classes" defines the classes which are posted to this dispatcher.static StringCONN_SELECTOR_KEYThe service definition uses the key suffix "connectionSelector" to define the selector used to monitor TCP socket channels accepted by the service socket.static StringCONN_TYPE_KEYBoth service and connection definitions use the "connectionType" to define the connection protocol type.static StringCONNECTION_PREFIXRemote connection keys are prefixed by "eBus.connection." and followed by the connection name as found inCONNECTIONS_KEY.static StringCONNECTIONS_KEYThe key "connections" contains a comma-separated list of remote connection names.static DurationDEFAULT_HEARTBEAT_DELAYBy default heart-beating is turned off.static DurationDEFAULT_HEARTBEAT_REPLY_DELAYBy default wait indefinitely for a heartbeat reply.static StringDEFAULT_KEYThe boolean "isDefault" property is used to specify when this dispatcher should be used as the default dispatcher.static EConfigure.MessageCompilerTypeDEFAULT_MESSAGE_COMPILERDefault eBus message compiler type isMessageCompilerType.JAVA_ASSIST.static intDEFAULT_NUMBER_THREADSThe default dispatcher thread count is 4.static DurationDEFAULT_PARK_TIMEThe default park time after spinning is 1 microsecond.static intDEFAULT_PRIORITYThe default dispatcher thread priority is 5.static DurationDEFAULT_QUANTUMThe default run quantum is 500 microseconds.static intDEFAULT_QUEUE_SIZEThis value specifies that there is no limit to the transmit queue size.static booleanDEFAULT_RECONNECT_FLAGBy default a lost connection is not reconnected.static longDEFAULT_RECONNECT_TIMEThe default reconnect time is 5 seconds.static intDEFAULT_RUN_QUEUE_CAPACITYDefault run queue capacity is 64.static intDEFAULT_SPIN_LIMITThe default spin limit is 2500000 calls toQueue.poll()before parking or yielding.static intDEFAULT_TASK_QUEUE_CAPACITYDefault eBus client task queue capacity is 1024.static StringDEFAULT_THREAD_TYPEThe default Dispatcher thread type isThreadType.BLOCKING.static StringDISCARD_POLICY_KEYWhen the maximum message backlog limit is breached, then this policy defines which messages should be discarded.static StringDISPATCHER_PREFIXDispatcher keys are prefixed by "dispatcher." and followed by the dispatcher name as found inDISPATCHERS_KEY.static StringDISPATCHER_TYPE_KEYTheEConfigure.DispatcherType"dispatcherType" property is used to specify the dispatcher thread type.static StringDISPATCHERS_KEYThe key "dispatchers" contains a comma-separated list of unique, client dispatcher names.static StringDTLS_PROTOCOL_NAMEGeneric DTLS protocol name is "DTLS".static StringEBUS_KEYAll properties keys are prefixed with "eBus".static StringFILTER_KEYThe service definition uses the "addressFilter" key suffix.static StringGROUP_KEYMulticast group address is stored in key "group".static StringHB_DELAY_KEYThe connection definition uses the "heartbeatDelay" key suffix.static StringHB_REPLY_DELAY_KEYThe connection definition uses the "heartbeatReplyDelay" key suffix.static StringHOST_KEYThe connection definition uses the "host" key suffix.static StringIDLE_TIME_KEYWhen a connection is idle (no messages sent or received) for a given time, that connection is automatically paused.static StringINBUFFER_SIZE_KEYBoth the service and connection definitions use the "inputBufferSize" key suffix.static StringIS_DYNAMIC_KEYMulticast query subject is stored in "isDynamic".static StringJSON_FILE_ENVUse-Dto set system property "net.sf.eBus.config.jsonFile" to point to the eBus JSON configuration file.static StringMAX_BACKLOG_SIZE_KEYMaximum allowed message backlog when paused.static StringMAX_CONNECT_TIME_KEYMaximum allowed time between pauses, irrespective of connection being busy.static StringMESSAGE_CLASS_KEYMulticast message class name is stored in "messageClass".static StringMSG_QUEUE_SIZE_KEYBoth the service and connection definitions use the "messageQueueSize" key suffix.static StringMULTICAST_KEYMulticast connections are stored in key "multicast".static StringMULTICAST_ROLE_KEYMulticast connection role is stored in key "role".static StringMULTIFEED_TYPE_KEYThe multi-feed type ofLISTorQUERYis stored in "multifeedType".static StringNAME_KEYKey "name" is used to extract the configuration object's name.static StringNET_IF_KEYMulticast group network interface is stored in key " networkInterface".static StringNOTIFICATION_KEYNotification multi-feed message keys are stored in key "notifications".static StringNUM_THREADS_KEYThe dispatcher definition uses "numberThreads" key suffix to specify the number of threads in the dispatcher.static StringOUTBUFFER_SIZE_KEYBoth the service and connection definitions use the "outputBufferSize" key suffix.static StringPARK_TIME_KEYIf the thread type isspin+park, then the integer.parkTimeproperty may be specified.static StringPAUSE_DURATION_KEYThe pause duration is stored in "pauseTime".static StringPAUSE_KEYIfCAN_PAUSE_KEYis set totrue, then the connection pause parameters are stored under the "pause" key.static StringPORT_KEYBoth the service and connection definitions use the "port" key suffix.static StringPRIORITY_KEYThe integer "priority" property is used to set the dispatcher thread priority.static StringPROTOCOL_KEYMulticast group protocol family is stored in key "protocolFamily".static StringQUANTUM_KEYThe key "quantum" defines the run quantum each client is initially assigned.static StringRECONNECT_DELAY_KEYThe connection definition uses the "reconnectTime" key suffix.static StringRECONNECT_KEYThe connection definition uses the "reconnect" key suffix.static StringRESUME_ON_BACKLOG_SIZE_KEYResumes the client connection automatically when the transmit queue reaches this size (application messages only).static StringRETRANSMIT_DELAY_KEYReliable UDP re-transmits an application message after waiting this long for an application message acknowledgement receipt.static StringRETRANSMIT_LIMIT_KEYReliable UDP re-transmits an application message this many times before declaring the connection lost.static StringRUN_QUEUE_CAPACITY_KEYRun queue capacity "runQueueCapacity" property is used to specify run queue maximum size.static StringSELECTOR_KEYBoth the service and connection definitions use the "selector" key suffix.static StringSERVICE_PREFIXService keys are prefixed by "eBus.service." and followed by the service name.static StringSERVICES_KEYThe key "services" contains a comma-separated list of local service names.static StringSOURCES_KEYMulticast source addresses are stored in key "sources".static StringSPIN_LIMIT_KEYIf the thread type isspin+parkorThreadType.SPINYIELD, then the integer.spinLimitproperty may be specified.static StringSUBJECT_LIST_KEYMulticast subject list is stored in "subjectList".static StringSUBJECT_QUERY_KEYMulticast subject query is stored in "subjectQuery".static StringSVC_SELECTOR_KEYThe service definition uses the key suffix "serviceSelector" to define the selector used to monitor the service socket.static StringTARGET_PORT_KEYMulticast target port is stored in key "targetPort".static StringTASK_QUEUE_CAPACITY_KEYeBus client task queue capacity "taskQueueCapacity" property is used to specify task queue maximum size for all eBus clients.static StringTHREAD_TYPE_KEYTherun queue"runQueueType" property is used to specify how the dispatcher thread acquires the next availableEClientfrom the run queue by either blocking, spinning, spin+park, or spin+yield.static StringTLS_PROTOCOL_NAMEGeneric TLS protocol name is "TLS".
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EConfigure.RemoteConnectionconnection(String name)Returns remote connection configuration with the given name.static EConfigure.ConnectionBuilderconnectionBuilder()Returns a newEConfigure.ConnectionBuilderinstance used to construct aERemoteApp.RemoteConnectionprogrammatically.static EConfigurecreate(EConfigure.MessageCompilerType messageCompiler, Map<String,EConfigure.Service> services, Map<String,EConfigure.RemoteConnection> connections, Map<String,EConfigure.MulticastConnection> mcastConnections, Map<String,EConfigure.Dispatcher> dispatchers)Creates an eBus configuration for the given service and remote connections.Each remote connection must have a unique name inconnections.EConfigure.Dispatcherdispatcher(String name)Returns the dispatcher configuration with the given name.static EConfigure.DispatcherBuilderdispatcherBuilder()Returns a newEConfigure.DispatcherBuilderinstance used to construct aEConfigure.Dispatcher.Map<String,EConfigure.Dispatcher>dispatchers()Returns the set of client dispatcher configurations.booleanequals(Object o)Returnstrueifois a non-nullEConfigureinstance with the same settings; returnsfalseotherwise.booleanhasDispatcher(String name)Returnstrueif there is a dispatcher defined with the given name.booleanhasDispatchers()Returnstrueif dispatchers are configured andfalseif not.inthashCode()Returns the configuration hash code.booleanhasMulticastConnection(String name)Returnstrueif there is a remote connection defined with the given name.booleanhasMulticastConnections()Returnstrueif multicast connections are configured andfalseif not.booleanhasRemoteConnection(String name)Returnstrueif there is a remote connection defined with the given name.booleanhasRemoteConnections()Returnstrueif remote connections are configured andfalseif not.booleanhasService(String name)Returnstrueif there is an eBus service defined with the given name.booleanhasServices()Returnstrueif at least one service is configured andfalseotherwise.static EConfigureload(com.typesafe.config.Config config)Returns the eBus service, remote connection, and dispatcher configurations found in the given JSON configuration.static Map<String,EConfigure.RemoteConnection>loadConnections(com.typesafe.config.Config config)Returns remote eBus connections found inconfig.static EConfigure.DispatcherloadDispatcher(com.typesafe.config.Config config)Returns a dispatcher configured based on the given JSON properties.static Map<String,EConfigure.Dispatcher>loadDispatchers(com.typesafe.config.Config config)Returns the eBus dispatcher configuration found in the given JSON configuration.static Map<String,EConfigure.MulticastConnection>loadMulticastConnections(com.typesafe.config.Config config)Returns multicast connections found inconfig.static Map<String,EConfigure.Service>loadServices(com.typesafe.config.Config config)Returns the eBus TCP services.EConfigure.MessageCompilerTypemessageCompiler()Returns eBus message compiler type.static EConfigure.MulticastBuildermulticastBuilder()Returns a newEConfigure.MulticastBuilderinstance used to construct aEMcastConnectionprogramatically.EConfigure.MulticastConnectionmulticastConnection(String name)Returns multicast connection configuration with the given name.Map<String,EConfigure.MulticastConnection>multicastConnections()Returns multicast connections map.static EConfigure.McastNotifyBuildernotificationBuilder()Returns a newEConfigure.McastNotifyBuilderinstance used to construct aEConfigure.McastNotifyConfig.static EConfigure.PauseBuilderpauseBuilder(EConfigure.ConnectionRole role)Returns a newEConfigure.PauseBuilderinstance used to construct aEConfigure.PauseConfig.Map<String,EConfigure.RemoteConnection>remoteConnections()Returns remote eBus connections map.static EConfigure.ServerBuilderserverBuilder()Returns a newServerBuilderinstance used to construct anEServerprogrammatically.EConfigure.Serviceservice(String name)Returns the eBus service for the given name.Map<String,EConfigure.Service>services()Returns the eBus services map.StringtoString()Returns the configuration text representation.
-
-
-
Field Detail
-
JSON_FILE_ENV
public static final String JSON_FILE_ENV
Use-Dto set system property "net.sf.eBus.config.jsonFile" to point to the eBus JSON configuration file. eBus will configure itself as per the file.- See Also:
- Constant Field Values
-
TLS_PROTOCOL_NAME
public static final String TLS_PROTOCOL_NAME
Generic TLS protocol name is "TLS".- See Also:
- Constant Field Values
-
DTLS_PROTOCOL_NAME
public static final String DTLS_PROTOCOL_NAME
Generic DTLS protocol name is "DTLS".- See Also:
- Constant Field Values
-
EBUS_KEY
public static final String EBUS_KEY
All properties keys are prefixed with "eBus".- See Also:
- Constant Field Values
-
NAME_KEY
public static final String NAME_KEY
Key "name" is used to extract the configuration object's name.- See Also:
- Constant Field Values
-
SERVICES_KEY
public static final String SERVICES_KEY
The key "services" contains a comma-separated list of local service names.- See Also:
- Constant Field Values
-
SERVICE_PREFIX
public static final String SERVICE_PREFIX
Service keys are prefixed by "eBus.service." and followed by the service name.- See Also:
- Constant Field Values
-
CONNECTIONS_KEY
public static final String CONNECTIONS_KEY
The key "connections" contains a comma-separated list of remote connection names.- See Also:
- Constant Field Values
-
CONNECTION_PREFIX
public static final String CONNECTION_PREFIX
Remote connection keys are prefixed by "eBus.connection." and followed by the connection name as found inCONNECTIONS_KEY.- See Also:
- Constant Field Values
-
DISPATCHERS_KEY
public static final String DISPATCHERS_KEY
The key "dispatchers" contains a comma-separated list of unique, client dispatcher names.- See Also:
- Constant Field Values
-
DISPATCHER_PREFIX
public static final String DISPATCHER_PREFIX
Dispatcher keys are prefixed by "dispatcher." and followed by the dispatcher name as found inDISPATCHERS_KEY.- See Also:
- Constant Field Values
-
CONN_TYPE_KEY
public static final String CONN_TYPE_KEY
Both service and connection definitions use the "connectionType" to define the connection protocol type.- See Also:
- Constant Field Values
-
PORT_KEY
public static final String PORT_KEY
Both the service and connection definitions use the "port" key suffix. Must be an integer > zero.- See Also:
- Constant Field Values
-
INBUFFER_SIZE_KEY
public static final String INBUFFER_SIZE_KEY
Both the service and connection definitions use the "inputBufferSize" key suffix. Must be an integer > zero.- See Also:
- Constant Field Values
-
OUTBUFFER_SIZE_KEY
public static final String OUTBUFFER_SIZE_KEY
Both the service and connection definitions use the "outputBufferSize" key suffix. Must be an integer > zero.- See Also:
- Constant Field Values
-
BYTE_ORDER_KEY
public static final String BYTE_ORDER_KEY
Both the service and connection definitions use the "byteOrder" key suffix. Must be eitherByteOrder.BIG_ENDIANorByteOrder.LITTLE_ENDIAN.The default is
ByteOrder.LITTLE_ENDIAN.- See Also:
- Constant Field Values
-
MSG_QUEUE_SIZE_KEY
public static final String MSG_QUEUE_SIZE_KEY
Both the service and connection definitions use the "messageQueueSize" key suffix. Must be an integer > zero.- See Also:
- Constant Field Values
-
SVC_SELECTOR_KEY
public static final String SVC_SELECTOR_KEY
The service definition uses the key suffix "serviceSelector" to define the selector used to monitor the service socket. Must be a known selector. If not specified, then defaults toAsyncChannel.defaultSelector.- See Also:
- Constant Field Values
-
CONN_SELECTOR_KEY
public static final String CONN_SELECTOR_KEY
The service definition uses the key suffix "connectionSelector" to define the selector used to monitor TCP socket channels accepted by the service socket. Must be a known selector. If not specified, then defaults toAsyncChannel.defaultSelector.- See Also:
- Constant Field Values
-
SELECTOR_KEY
public static final String SELECTOR_KEY
Both the service and connection definitions use the "selector" key suffix. Must be a known selector. If not specified, then defaults toAsyncChannel.defaultSelector.- See Also:
- Constant Field Values
-
HOST_KEY
public static final String HOST_KEY
The connection definition uses the "host" key suffix. Must be either a valid host name or IP address in dotted notation.- See Also:
- Constant Field Values
-
BIND_HOST_KEY
public static final String BIND_HOST_KEY
The connection definition uses the "bindHost" key suffix. Must be either a valid host name or IP address in dotted notation.- See Also:
- Constant Field Values
-
BIND_PORT_KEY
public static final String BIND_PORT_KEY
The connection definition uses the "bindPort" key suffix. Must be an integer ≥ zero.- See Also:
- Constant Field Values
-
RECONNECT_KEY
public static final String RECONNECT_KEY
The connection definition uses the "reconnect" key suffix. Must be a boolean.- See Also:
- Constant Field Values
-
RECONNECT_DELAY_KEY
public static final String RECONNECT_DELAY_KEY
The connection definition uses the "reconnectTime" key suffix. Must be an integer ≥ zero.- See Also:
- Constant Field Values
-
HB_DELAY_KEY
public static final String HB_DELAY_KEY
The connection definition uses the "heartbeatDelay" key suffix. Must be an integer ≥ zero.- See Also:
- Constant Field Values
-
HB_REPLY_DELAY_KEY
public static final String HB_REPLY_DELAY_KEY
The connection definition uses the "heartbeatReplyDelay" key suffix. Must be an integer ≥ zero.- See Also:
- Constant Field Values
-
FILTER_KEY
public static final String FILTER_KEY
The service definition uses the "addressFilter" key suffix. Must be a valid address filter list.- See Also:
- Constant Field Values
-
DEFAULT_KEY
public static final String DEFAULT_KEY
The boolean "isDefault" property is used to specify when this dispatcher should be used as the default dispatcher. At most one dispatcher should be designated as the default dispatcher. If more than one is so designated, the subsequent.isDefaultkeys are ignored.If no user-defined dispatcher is marked as default, then a
blocking,normal prioritydispatcher namedEClient.DEFAULT_DISPATCHERis used as the default dispatcher.The default value is
false(not the default selector).- See Also:
- Constant Field Values
-
DISPATCHER_TYPE_KEY
public static final String DISPATCHER_TYPE_KEY
TheEConfigure.DispatcherType"dispatcherType" property is used to specify the dispatcher thread type. This property allows eBus tasks to be executed on supported third-party threads.The default value is
EConfigure.DispatcherType.EBUS.- See Also:
- Constant Field Values
-
TASK_QUEUE_CAPACITY_KEY
public static final String TASK_QUEUE_CAPACITY_KEY
eBus client task queue capacity "taskQueueCapacity" property is used to specify task queue maximum size for all eBus clients.Default value is
DEFAULT_TASK_QUEUE_CAPACITY.- See Also:
- Constant Field Values
-
THREAD_TYPE_KEY
public static final String THREAD_TYPE_KEY
Therun queue"runQueueType" property is used to specify how the dispatcher thread acquires the next availableEClientfrom the run queue by either blocking, spinning, spin+park, or spin+yield.The default value is
DEFAULT_THREAD_TYPE.- See Also:
- Constant Field Values
-
RUN_QUEUE_CAPACITY_KEY
public static final String RUN_QUEUE_CAPACITY_KEY
Run queue capacity "runQueueCapacity" property is used to specify run queue maximum size. Only used for non-blocking thread types.Default value is
DEFAULT_RUN_QUEUE_CAPACITY.- See Also:
- Constant Field Values
-
SPIN_LIMIT_KEY
public static final String SPIN_LIMIT_KEY
If the thread type isspin+parkorThreadType.SPINYIELD, then the integer.spinLimitproperty may be specified. This setting defines the number of times the Dispatcher thread may callQueue.poll()before parking or yielding.This value must be > zero.
Default values is
DEFAULT_SPIN_LIMIT.This property is ignored is the thread type is not spin+park or spin+yield.
- See Also:
- Constant Field Values
-
PARK_TIME_KEY
public static final String PARK_TIME_KEY
If the thread type isspin+park, then the integer.parkTimeproperty may be specified. This setting specifies the nanosecond park time taken betweenQueue.poll()spin cycles.This value must be > zero.
Default values is
DEFAULT_PARK_TIME.This property is ignored is the thread type is not spin+park.
- See Also:
- Constant Field Values
-
PRIORITY_KEY
public static final String PRIORITY_KEY
The integer "priority" property is used to set the dispatcher thread priority.The default value is
Thread.NORM_PRIORITY.- See Also:
- Constant Field Values
-
QUANTUM_KEY
public static final String QUANTUM_KEY
The key "quantum" defines the run quantum each client is initially assigned. If a client exhausts its quantum, the client is placed back on the run queue.- See Also:
- Constant Field Values
-
CLASSES_KEY
public static final String CLASSES_KEY
The key "classes" defines the classes which are posted to this dispatcher. This key is ignored if.isDefaultis set totrue.- See Also:
- Constant Field Values
-
NUM_THREADS_KEY
public static final String NUM_THREADS_KEY
The dispatcher definition uses "numberThreads" key suffix to specify the number of threads in the dispatcher.- See Also:
- Constant Field Values
-
CAN_PAUSE_KEY
public static final String CAN_PAUSE_KEY
If a remote client connection may be paused, then this property is defined and set totrue. If not set then assumed to befalseand the connection cannot be paused. This key may be defined for both acceptor and initiator connections.- See Also:
- Constant Field Values
-
PAUSE_KEY
public static final String PAUSE_KEY
IfCAN_PAUSE_KEYis set totrue, then the connection pause parameters are stored under the "pause" key. This key may be defined for both acceptor and initiator connections.- See Also:
- Constant Field Values
-
PAUSE_DURATION_KEY
public static final String PAUSE_DURATION_KEY
The pause duration is stored in "pauseTime". This is a sub-key underPAUSE_KEY. This key may be defined for both acceptor and initiator connections.- See Also:
- Constant Field Values
-
MAX_BACKLOG_SIZE_KEY
public static final String MAX_BACKLOG_SIZE_KEY
Maximum allowed message backlog when paused. This key may be defined for both acceptor and initiator connections.- See Also:
- Constant Field Values
-
DISCARD_POLICY_KEY
public static final String DISCARD_POLICY_KEY
When the maximum message backlog limit is breached, then this policy defines which messages should be discarded. This key is defined for initiator connections only.- See Also:
- Constant Field Values
-
IDLE_TIME_KEY
public static final String IDLE_TIME_KEY
When a connection is idle (no messages sent or received) for a given time, that connection is automatically paused. This value is set in the "idleTime" property.- See Also:
- Constant Field Values
-
MAX_CONNECT_TIME_KEY
public static final String MAX_CONNECT_TIME_KEY
Maximum allowed time between pauses, irrespective of connection being busy. This value is set in the the "maxConnectTime" property.- See Also:
- Constant Field Values
-
RESUME_ON_BACKLOG_SIZE_KEY
public static final String RESUME_ON_BACKLOG_SIZE_KEY
Resumes the client connection automatically when the transmit queue reaches this size (application messages only). This trigger is turned off when set to zero which is the default value. This value should be less than the maximum backlog size to be effective.- See Also:
- Constant Field Values
-
MULTICAST_KEY
public static final String MULTICAST_KEY
Multicast connections are stored in key "multicast".- See Also:
- Constant Field Values
-
MULTICAST_ROLE_KEY
public static final String MULTICAST_ROLE_KEY
Multicast connection role is stored in key "role".- See Also:
- Constant Field Values
-
GROUP_KEY
public static final String GROUP_KEY
Multicast group address is stored in key "group".- See Also:
- Constant Field Values
-
TARGET_PORT_KEY
public static final String TARGET_PORT_KEY
Multicast target port is stored in key "targetPort".- See Also:
- Constant Field Values
-
NET_IF_KEY
public static final String NET_IF_KEY
Multicast group network interface is stored in key " networkInterface".- See Also:
- Constant Field Values
-
SOURCES_KEY
public static final String SOURCES_KEY
Multicast source addresses are stored in key "sources". This property is optional.- See Also:
- Constant Field Values
-
PROTOCOL_KEY
public static final String PROTOCOL_KEY
Multicast group protocol family is stored in key "protocolFamily".- See Also:
- Constant Field Values
-
NOTIFICATION_KEY
public static final String NOTIFICATION_KEY
Notification multi-feed message keys are stored in key "notifications".- See Also:
- Constant Field Values
-
MULTIFEED_TYPE_KEY
public static final String MULTIFEED_TYPE_KEY
The multi-feed type ofLISTorQUERYis stored in "multifeedType".- See Also:
- Constant Field Values
-
MESSAGE_CLASS_KEY
public static final String MESSAGE_CLASS_KEY
Multicast message class name is stored in "messageClass".- See Also:
- Constant Field Values
-
SUBJECT_QUERY_KEY
public static final String SUBJECT_QUERY_KEY
Multicast subject query is stored in "subjectQuery".- See Also:
- Constant Field Values
-
SUBJECT_LIST_KEY
public static final String SUBJECT_LIST_KEY
Multicast subject list is stored in "subjectList".- See Also:
- Constant Field Values
-
IS_DYNAMIC_KEY
public static final String IS_DYNAMIC_KEY
Multicast query subject is stored in "isDynamic". This key is used only ifMULTIFEED_TYPE_KEYis set toQUERY.- See Also:
- Constant Field Values
-
RETRANSMIT_DELAY_KEY
public static final String RETRANSMIT_DELAY_KEY
Reliable UDP re-transmits an application message after waiting this long for an application message acknowledgement receipt.- See Also:
- Constant Field Values
-
RETRANSMIT_LIMIT_KEY
public static final String RETRANSMIT_LIMIT_KEY
Reliable UDP re-transmits an application message this many times before declaring the connection lost. This does not include the initial message transmit.- See Also:
- Constant Field Values
-
DEFAULT_THREAD_TYPE
public static final String DEFAULT_THREAD_TYPE
The default Dispatcher thread type isThreadType.BLOCKING.
-
DEFAULT_SPIN_LIMIT
public static final int DEFAULT_SPIN_LIMIT
The default spin limit is 2500000 calls toQueue.poll()before parking or yielding.- See Also:
- Constant Field Values
-
DEFAULT_PARK_TIME
public static final Duration DEFAULT_PARK_TIME
The default park time after spinning is 1 microsecond.
-
DEFAULT_PRIORITY
public static final int DEFAULT_PRIORITY
The default dispatcher thread priority is 5.- See Also:
- Constant Field Values
-
DEFAULT_QUANTUM
public static final Duration DEFAULT_QUANTUM
The default run quantum is 500 microseconds.
-
DEFAULT_NUMBER_THREADS
public static final int DEFAULT_NUMBER_THREADS
The default dispatcher thread count is 4.- See Also:
- Constant Field Values
-
DEFAULT_QUEUE_SIZE
public static final int DEFAULT_QUEUE_SIZE
This value specifies that there is no limit to the transmit queue size.- See Also:
- Constant Field Values
-
DEFAULT_RECONNECT_FLAG
public static final boolean DEFAULT_RECONNECT_FLAG
By default a lost connection is not reconnected.- See Also:
- Constant Field Values
-
DEFAULT_RECONNECT_TIME
public static final long DEFAULT_RECONNECT_TIME
The default reconnect time is 5 seconds. This value is used only if reconnection is set totruewhen the connection wasERemoteApp.openConnection(EConfigure.RemoteConnection) opened.- See Also:
- Constant Field Values
-
DEFAULT_HEARTBEAT_DELAY
public static final Duration DEFAULT_HEARTBEAT_DELAY
By default heart-beating is turned off.
-
DEFAULT_HEARTBEAT_REPLY_DELAY
public static final Duration DEFAULT_HEARTBEAT_REPLY_DELAY
By default wait indefinitely for a heartbeat reply.
-
DEFAULT_MESSAGE_COMPILER
public static final EConfigure.MessageCompilerType DEFAULT_MESSAGE_COMPILER
Default eBus message compiler type isMessageCompilerType.JAVA_ASSIST.
-
DEFAULT_TASK_QUEUE_CAPACITY
public static final int DEFAULT_TASK_QUEUE_CAPACITY
Default eBus client task queue capacity is 1024.- See Also:
- Constant Field Values
-
DEFAULT_RUN_QUEUE_CAPACITY
public static final int DEFAULT_RUN_QUEUE_CAPACITY
Default run queue capacity is 64. This value is used only for non-blocking thread types and ignored for blocking queues.- See Also:
- Constant Field Values
-
-
Method Detail
-
equals
public boolean equals(Object o)
Returnstrueifois a non-nullEConfigureinstance with the same settings; returnsfalseotherwise.
-
hashCode
public int hashCode()
Returns the configuration hash code.
-
toString
public String toString()
Returns the configuration text representation.
-
messageCompiler
public EConfigure.MessageCompilerType messageCompiler()
Returns eBus message compiler type.- Returns:
- eBus message compiler type.
-
hasServices
public boolean hasServices()
Returnstrueif at least one service is configured andfalseotherwise.- Returns:
trueif there is a service.
-
hasService
public boolean hasService(String name)
Returnstrueif there is an eBus service defined with the given name.- Parameters:
name- service name.- Returns:
trueif service exists.
-
services
public Map<String,EConfigure.Service> services()
Returns the eBus services map.- Returns:
- the eBus services map.
-
service
public EConfigure.Service service(String name)
Returns the eBus service for the given name. Returnsnullif there is no service forname.- Parameters:
name- service name.- Returns:
- eBus service with the given name.
-
hasRemoteConnections
public boolean hasRemoteConnections()
Returnstrueif remote connections are configured andfalseif not.- Returns:
trueif there are remote connections.
-
hasRemoteConnection
public boolean hasRemoteConnection(String name)
Returnstrueif there is a remote connection defined with the given name.- Parameters:
name- connection name.- Returns:
trueif named connection exists.
-
remoteConnections
public Map<String,EConfigure.RemoteConnection> remoteConnections()
Returns remote eBus connections map.- Returns:
- remote eBus connections map.
-
connection
public EConfigure.RemoteConnection connection(String name)
Returns remote connection configuration with the given name. Returnsnullif there is no such named remote connection configuration.- Parameters:
name- remote connection configuration name.- Returns:
- remote connection configuration instance or
nullif no such instance exists.
-
hasMulticastConnections
public boolean hasMulticastConnections()
Returnstrueif multicast connections are configured andfalseif not.- Returns:
trueif there are multicast connections.
-
hasMulticastConnection
public boolean hasMulticastConnection(String name)
Returnstrueif there is a remote connection defined with the given name.- Parameters:
name- multicast connection name.- Returns:
trueif named multicast connection exists.
-
multicastConnections
public Map<String,EConfigure.MulticastConnection> multicastConnections()
Returns multicast connections map.- Returns:
- multicast connections map.
-
multicastConnection
public EConfigure.MulticastConnection multicastConnection(String name)
Returns multicast connection configuration with the given name. Returnsnullif there is no such named multicast connection configuration.- Parameters:
name- multicast connection configuration name.- Returns:
- multicast connection configuration instance or
nullif no such instance exists.
-
hasDispatchers
public boolean hasDispatchers()
Returnstrueif dispatchers are configured andfalseif not.- Returns:
trueif there are dispatchers configured.
-
hasDispatcher
public boolean hasDispatcher(String name)
Returnstrueif there is a dispatcher defined with the given name.- Parameters:
name- dispatcher name.- Returns:
trueif dispatcher exists.
-
dispatchers
public Map<String,EConfigure.Dispatcher> dispatchers()
Returns the set of client dispatcher configurations.- Returns:
- client dispatcher configurations.
-
dispatcher
public EConfigure.Dispatcher dispatcher(String name)
Returns the dispatcher configuration with the given name. Returnsnullif there is no such named dispatcher.- Parameters:
name- dispatcher configuration name.- Returns:
- dispatcher configuration instance or
null.
-
create
public static EConfigure create(EConfigure.MessageCompilerType messageCompiler, Map<String,EConfigure.Service> services, Map<String,EConfigure.RemoteConnection> connections, Map<String,EConfigure.MulticastConnection> mcastConnections, Map<String,EConfigure.Dispatcher> dispatchers)
Creates an eBus configuration for the given service and remote connections.Each remote connection must have a unique name inconnections.- Parameters:
messageCompiler- eBus message and field compiler.services- the local eBus services.connections- the remote eBus connections.mcastConnections- multicast connections.dispatchers- dispatcher thread configurations.- Returns:
- an eBus configuration based on the given parameters.
- See Also:
EConfigure.Service,EConfigure.RemoteConnection,EConfigure.MulticastConnection,EConfigure.Dispatcher
-
serverBuilder
public static EConfigure.ServerBuilder serverBuilder()
Returns a newServerBuilderinstance used to construct anEServerprogrammatically.- Returns:
- new
ServerBuilderinstance.
-
connectionBuilder
public static EConfigure.ConnectionBuilder connectionBuilder()
Returns a newEConfigure.ConnectionBuilderinstance used to construct aERemoteApp.RemoteConnectionprogrammatically.- Returns:
- new
ConnectionBuilderinstance.
-
multicastBuilder
public static EConfigure.MulticastBuilder multicastBuilder()
Returns a newEConfigure.MulticastBuilderinstance used to construct aEMcastConnectionprogramatically.- Returns:
- new
MulticastBuilderinstance.
-
dispatcherBuilder
public static EConfigure.DispatcherBuilder dispatcherBuilder()
Returns a newEConfigure.DispatcherBuilderinstance used to construct aEConfigure.Dispatcher.- Returns:
- new
DispatcherBuilderinstance.
-
pauseBuilder
public static EConfigure.PauseBuilder pauseBuilder(EConfigure.ConnectionRole role)
Returns a newEConfigure.PauseBuilderinstance used to construct aEConfigure.PauseConfig.- Parameters:
role- build pause configuration for this connection role.- Returns:
- new
EConfigure.PauseBuilderinstance.
-
notificationBuilder
public static EConfigure.McastNotifyBuilder notificationBuilder()
Returns a newEConfigure.McastNotifyBuilderinstance used to construct aEConfigure.McastNotifyConfig.- Returns:
- multicast notification builder.
-
load
public static EConfigure load(com.typesafe.config.Config config)
Returns the eBus service, remote connection, and dispatcher configurations found in the given JSON configuration.An example of the eBus JSON configuration:
Note: Each name must be unique within the selectors, services, and connections lists.
"selectors" : [ { "name" : "mdSelector" "type" : "spinning" "isDefault" : "false" "priority" : 9 }, { "name" : "stockSelector" "type" : "spin+park" "isDefault" : "false" "priority" : 6 "spinLimit" : 3000000 "parkTime" : 1000 } ] "services" : [ { "name" : "stockService" "port" : 12345 "addressFilter" : [ "198.168.3.2", "198.168.3.3:55001" ] "serviceSelector" : "stockSelector" "connectionSelector" : "stockSelector" "byteOrder" : "BIG_ENDIAN" "inputBufferSize" : 8192 "outputBufferSize" : 65536 "messageQueueSize" : 100 "heartbeatDelay" : 30000 "heartbeatReply" : 500 "canPause" : false } ] "connections" : [ { "name" : "marketData" "host" : "192.168.3.4" "port" : 10000 "inputBufferSize" : 65536 "outputBufferSize" : 8192 "byteOrder" : "BIG_ENDIAN" "messageQueueSize" : 0 "selector" : "mdSelector" "reconnect" : true "reconnectTime" : 500 "canPause" : false }, { "name" : "stockOrders" "host" : "StocksRUs.com" "port" : 10001 "bindPort" : 55000 "inputBufferSize" : 8192 "outputBufferSize" : 65536 "byteOrder" : "BIG_ENDIAN" "messageQueueSize" : 10 "selector" : "stockSelector" "reconnect" : true "reconnectTime" : 500 "canPause" : false } ]- Parameters:
config- extract the eBus configuration from these JSON properties.- Returns:
- eBus configuration settings.
- Throws:
com.typesafe.config.ConfigException- ifconfigcontains an invalid or incomplete eBus configuration.
-
loadServices
public static Map<String,EConfigure.Service> loadServices(com.typesafe.config.Config config)
Returns the eBus TCP services. Returns an empty map if there are no eBus services.- Parameters:
config-typesafe.configHOCON configuration containing service definition.- Returns:
- eBus service.
- Throws:
com.typesafe.config.ConfigException- if a service definition is invalid.- See Also:
load(Config)
-
loadConnections
public static Map<String,EConfigure.RemoteConnection> loadConnections(com.typesafe.config.Config config)
Returns remote eBus connections found inconfig. If there are no remote connections then returns an empty map.- Parameters:
config-typesafe.configHOCON configuration containing connection definitions.- Returns:
- remote eBus connections map.
- Throws:
com.typesafe.config.ConfigException- if a remote connection definition is invalid.- See Also:
load(Config)
-
loadMulticastConnections
public static Map<String,EConfigure.MulticastConnection> loadMulticastConnections(com.typesafe.config.Config config)
Returns multicast connections found inconfig. If there are no multicast connections then returns an empty map.- Parameters:
config-typesafe.configHOCON configuration containing multicast connection definitions.- Returns:
- multicast connections map.
- Throws:
com.typesafe.config.ConfigException- if an invalid multicast connection definition is found.
-
loadDispatchers
public static Map<String,EConfigure.Dispatcher> loadDispatchers(com.typesafe.config.Config config)
Returns the eBus dispatcher configuration found in the given JSON configuration. If this is no dispatcher configuration found, then returns an empty map.- Parameters:
config- JSON configuration.- Returns:
- map from dispatcher name to its configuration.
- Throws:
com.typesafe.config.ConfigException- ifconfigcontains an invalid dispatcher configuration.
-
loadDispatcher
public static EConfigure.Dispatcher loadDispatcher(com.typesafe.config.Config config)
Returns a dispatcher configured based on the given JSON properties.- Parameters:
config- JSCON configuration.- Returns:
- dispatcher
- Throws:
com.typesafe.config.ConfigException- ifconfigcontains an invalid dispatcher configuration.
-
-