The ConnectionData class is used to encapsulate the configuration and metadata required for a TCP/IP connection to a remote HL7 server. It defines the host, ports, security settings (TLS), parsing logic, and the underlying protocol.
Key configuration parameters include:
host: The remote server hostname or IP address.port / outboundPort: The primary port for the connection.port2 / inboundPort: An additional port (used in specific connection scenarios).tls: A boolean indicating whether to use TLS encryption.parser: The Parser instance used to handle HL7 messages.protocol: The LowerLayerProtocol implementation (e.g., MLLP).connectionTimeout: An optional integer specifying the connection timeout.socketFactory: A custom SocketFactory for managing socket creation; if not provided, a StandardSocketFactory is used.
// Example: Creating a basic connection configuration
ConnectionData config = new ConnectionData(
"localhost",
4556,
myParser,
myProtocol
);
// Example: Creating a TLS-enabled connection with a timeout
ConnectionData tlsConfig = new ConnectionData(
"remote-server.com",
4556,
myParser,
myProtocol,
true,
5000
);