qbit-ext/jms/src/main/java/io/advantageous/qbit/jms/JmsServiceBuilder.java
public Supplier<Connection> getConnectionSupplier() {
        final boolean startConnection = isStartConnection();

        if (connectionSupplier == null) {
            if (getUserName() == null) {
                connectionSupplier = () -> {
                    try {
                        final Connection connection = getConnectionFactory().createConnection();
                        if (startConnection) {
                            connection.start();
                        }
                        return connection;
                    } catch (JMSException e) {
                        throw new JmsNotConnectedException("Unable to create context", e);
                    }
                };
            } else {
                final String userName = getUserName();
                final String password = getPassword();

                connectionSupplier = () -> {
                    try {
                        final Connection connection = getConnectionFactory().createConnection(userName, password);
                        if (startConnection) {
                            connection.start();
                        }
                        return connection;
                    } catch (JMSException e) {
                        throw new JmsNotConnectedException("Unable to create context for user " + userName, e);
                    }
                };
            }
        }
        return connectionSupplier;
    }
public Supplier<Connection> getConnectionSupplier() {
        final boolean startConnection = isStartConnection();

        if (connectionSupplier == null) {
            if (getUserName() == null) {
                connectionSupplier = () -> {
                    try {
                        final Connection connection = getConnectionFactory().createConnection();
                        if (startConnection) {
                            connection.start();
                        }
                        return connection;
                    } catch (JMSException e) {
                        throw new JmsNotConnectedException("Unable to create context", e);
                    }
                };
            } else {
                final String userName = getUserName();
                final String password = getPassword();

                connectionSupplier = () -> {
                    try {
                        final Connection connection = getConnectionFactory().createConnection(userName, password);
                        if (startConnection) {
                            connection.start();
                        }
                        return connection;
                    } catch (JMSException e) {
                        throw new JmsNotConnectedException("Unable to create context for user " + userName, e);
                    }
                };
            }
        }
        return connectionSupplier;
    }
public Supplier < Connection > getConnectionSupplier ( ) { final boolean startConnection = isStartConnection ( ) ; if ( connectionSupplier == null ) { if ( getUserName ( ) == null ) { connectionSupplier = ( ) -> { try { final Connection connection = getConnectionFactory ( ) . createConnection ( ) ; if ( startConnection ) { connection . start ( ) ; } return connection ; } catch ( JMSException e ) { throw new JmsNotConnectedException ( "Unable to create context" , e ) ; } } ; } else { final String userName = getUserName ( ) ; final String password = getPassword ( ) ; connectionSupplier = ( ) -> { try { final Connection connection = getConnectionFactory ( ) . createConnection ( userName , password ) ; if ( startConnection ) { connection . start ( ) ; } return connection ; } catch ( JMSException e ) { throw new JmsNotConnectedException ( "Unable to create context for user " + userName , e ) ; } } ; } } return connectionSupplier ; }
If the user name is set, use the user name and password to create the JMS connection.

@return connection supplier
@see JmsServiceBuilder#connectionSupplier
If the user name is set use the user name and password to create the JMS connection .