UNPKG

diffusion

Version:

Diffusion JavaScript client

168 lines (167 loc) 6.84 kB
"use strict"; /** * @module Session.remoteServers */ Object.defineProperty(exports, "__esModule", { value: true }); exports.RemoteServerType = exports.ConnectionState = exports.ConnectionOption = void 0; /** * Connection options for use with {@link SecondaryServer}s. */ var ConnectionOption; (function (ConnectionOption) { /** * Specifies the connection timeout session attribute value (in milliseconds). * * If a value is not specified the session's default connection timeout is used. */ ConnectionOption[ConnectionOption["CONNECTION_TIMEOUT"] = 1] = "CONNECTION_TIMEOUT"; /** * Specifies the input buffer size session attribute. * * This is the size of the input buffer to use for the connection with the remote server. * It is used to receive messages from the remote server. * This should be set to the same size as the output buffer used at the remote server. * * If not specified, a default of 1024k is used. */ ConnectionOption[ConnectionOption["INPUT_BUFFER_SIZE"] = 2] = "INPUT_BUFFER_SIZE"; /** * Specifies the maximum queue size session attribute. * * This is the maximum number of messages that can be queued to send to the remote server. * If this number is exceeded, the connection will be closed. * This must be sufficient to cater for messages that may be queued whilst disconnected (awaiting reconnect). * * The default value is 10,000 messages. */ ConnectionOption[ConnectionOption["MAXIMUM_QUEUE_SIZE"] = 3] = "MAXIMUM_QUEUE_SIZE"; /** * Specifies the output buffer size session attribute. * * This is the size of the output buffer to use for the connection with the remote server. * It is used to send messages to the remote server. * This should be set to the same size as the input buffer used by the remote server. * * If not specified, a default of 1024k is used. */ ConnectionOption[ConnectionOption["OUTPUT_BUFFER_SIZE"] = 4] = "OUTPUT_BUFFER_SIZE"; /** * Specifies the reconnection timeout session attribute. * * This is the total time in milliseconds that will be allowed to reconnect a failed connection. * * For reconnection to work the remote server connector must have been configured to support reconnection. * * If a value is not specified the session's default reconnection timeout is used. * * This value cannot be supplied for a * {@link RemoteServerType.SECONDARY_ACCEPTOR SECONDARY_ACCEPTOR} server. */ ConnectionOption[ConnectionOption["RECONNECTION_TIMEOUT"] = 5] = "RECONNECTION_TIMEOUT"; /** * Specifies the recovery buffer size session attribute. * * If the remote server is configured to support reconnection, a session established with a non-zero * reconnect-timeout retains a buffer of sent messages. * If the session disconnects and reconnects, this buffer is used to re-send messages that the server * has not received. * * The default value is 10,000 messages. If reconnect-timeout is 0 then this value is ignored. * * This value cannot be supplied for a * {@link RemoteServerType.SECONDARY_ACCEPTOR SECONDARY_ACCEPTOR} server. */ ConnectionOption[ConnectionOption["RECOVERY_BUFFER_SIZE"] = 6] = "RECOVERY_BUFFER_SIZE"; /** * Specifies the delay after losing a connection before attempting a reconnection. * * The value is specified in milliseconds. Default 1000 (1 second). * * This value cannot be supplied for a * {@link RemoteServerType.SECONDARY_ACCEPTOR SECONDARY_ACCEPTOR} server. */ ConnectionOption[ConnectionOption["RETRY_DELAY"] = 7] = "RETRY_DELAY"; /** * Specifies the write timeout session attribute value (in milliseconds). * * If a value is not specified the session's default write timeout is used. */ ConnectionOption[ConnectionOption["WRITE_TIMEOUT"] = 8] = "WRITE_TIMEOUT"; })(ConnectionOption = exports.ConnectionOption || (exports.ConnectionOption = {})); /** * Represents the current connection state of a remote server. */ var ConnectionState; (function (ConnectionState) { /** * The connection is inactive. * * This means that the remote server can successfully connect but a * physical connection is not being maintained as there are no * components that require the remote server. * * If in an inactive or failed state, a test connection will have * been tried to check that the connection can be made and the * connection will then have been closed. */ ConnectionState[ConnectionState["INACTIVE"] = 1] = "INACTIVE"; /** * The remote server is connected and actively in use by components * that require it. */ ConnectionState[ConnectionState["CONNECTED"] = 2] = "CONNECTED"; /** * The connection has failed but a retry is scheduled. * * In this case {@link RemoteServerStatus.failureMessage} * will provide details of the failure that resulted in a retry. */ ConnectionState[ConnectionState["RETRYING"] = 3] = "RETRYING"; /** * The connection failed to establish. * * If the connection was in an inactive or failed state, a * test connection was tried and failed. * * In this case {@link RemoteServerStatus.failureMessage} * will provide more detail. */ ConnectionState[ConnectionState["FAILED"] = 4] = "FAILED"; /** * The named remote server did not exist. */ ConnectionState[ConnectionState["MISSING"] = 5] = "MISSING"; })(ConnectionState = exports.ConnectionState || (exports.ConnectionState = {})); /** * The remote server type. */ var RemoteServerType; (function (RemoteServerType) { /** * Secondary initiator remote server. * * Defined on secondary servers. * * This type will initiate connection from a secondary server * (cluster) to a primary server (cluster member). */ RemoteServerType[RemoteServerType["SECONDARY_INITIATOR"] = 1] = "SECONDARY_INITIATOR"; /** * Primary initiator. * * Defined on primary servers. * * This type will connect to an inbound remote server of the same * name configured at the secondary server (cluster). */ RemoteServerType[RemoteServerType["PRIMARY_INITIATOR"] = 2] = "PRIMARY_INITIATOR"; /** * Secondary acceptor remote server. * * Defined on secondary servers. * * This type will accept a primary remote server connection and * support remote topic views. */ RemoteServerType[RemoteServerType["SECONDARY_ACCEPTOR"] = 3] = "SECONDARY_ACCEPTOR"; })(RemoteServerType = exports.RemoteServerType || (exports.RemoteServerType = {}));