qbit-ext/jms/src/main/java/io/advantageous/qbit/jms/JmsService.java
private Connection getConnection() {

        if (!connectionOption.isPresent()) {
            final Connection connection = connectionSupplier.get();

            if (connection instanceof ActiveMQConnection) {
                ((ActiveMQConnection) connection).addTransportListener(new TransportListener() {
                    @Override
                    public void onCommand(Object command) {

                    }

                    @Override
                    public void onException(IOException error) {
                    }

                    @Override
                    public void transportInterupted() {
                        connected.set(false);
                    }

                    @Override
                    public void transportResumed() {
                        connected.set(true);
                    }
                });
            }


            connected.set(true);

            if (startConnection) {
                try {
                    connection.start();
                } catch (JMSException e) {
                    throw new JmsException("Unable to start JMS connection", e);
                }
            }
            connectionOption = Optional.of(connection);
        }
        return connectionOption.get();
    }
private Connection getConnection() {

        if (!connectionOption.isPresent()) {
            final Connection connection = connectionSupplier.get();

            if (connection instanceof ActiveMQConnection) {
                ((ActiveMQConnection) connection).addTransportListener(new TransportListener() {
                    @Override
                    public void onCommand(Object command) {

                    }

                    @Override
                    public void onException(IOException error) {
                    }

                    @Override
                    public void transportInterupted() {
                        connected.set(false);
                    }

                    @Override
                    public void transportResumed() {
                        connected.set(true);
                    }
                });
            }


            connected.set(true);

            if (startConnection) {
                try {
                    connection.start();
                } catch (JMSException e) {
                    throw new JmsException("Unable to start JMS connection", e);
                }
            }
            connectionOption = Optional.of(connection);
        }
        return connectionOption.get();
    }
Get the current connection or create one using the connectionSupplier.

@return JMS Connection