public EnhancedServer remoteConnection(String name) {
        return remoteConnection(name, (config) -> {
        });
    }

    /**
     * Setup a named remote connection to a remote message broker.
     *
     * @param name   The name of the connection.
     * @param config The configuration.
     * @return This server.
     */
    public EnhancedServer remoteConnection(String name, RemoteConnection.Consumer config) {
        return remoteConnection(() -> {
            RemoteConnection connection = new RemoteConnection(name);
            config.accept(connection);
            return connection;
        });
    }


    /**
     * Setup a remote connection to a remote message broker.
     *
     * @param supplier The supplier of the configuration.
     * @return This server.
     */
    public EnhancedServer remoteConnection(RemoteConnection.Supplier supplier) {
        RemoteConnection connection = supplier.get();


        this.remoteConnections.add(connection);

        return this;
    }


    public EnhancedServer enableRemote() {
        enableHTTPConnections();

        connectionFactory(new ConnectionFactory<>("RemoteConnectionFactory")
                                  .connectors(Collections.singletonList("http-connector"))
                                  .entries("java:/RemoteConnectionFactory", "java:jboss/exported/jms/RemoteConnectionFactory"));
        return this;
    }

    private EnhancedServer enableHTTPConnections() {
        if (this.subresources().acceptor(("http-acceptor")) != null) {
            return this;
        }
        httpAcceptor(new HTTPAcceptor("http-acceptor")
                             .httpListener("default"));
        httpAcceptor(new HTTPAcceptor("http-acceptor-throughput")
                             .httpListener("default")
                             .param("batch-delay", "50")
                             .param("direct-deliver", "false"));
        httpConnector(new HTTPConnector(HTTP_CONNECTOR)
                              .socketBinding("http")
                              .endpoint("http-acceptor"));
        httpConnector(new HTTPConnector("http-connector-throughput")
                              .socketBinding("http")
                              .endpoint("http-acceptor-throughput")
                              .param("batch-delay", "50"));
        return this;
    }

    @SuppressWarnings("unchecked")
    @Override
    public EnhancedServer jmsQueue(String childKey, JMSQueueConsumer config) {
        return super.jmsQueue(childKey, (q) -> {
            if (config != null) {
                config.accept(q);
            }
            if (q.entries() == null || q.entries().isEmpty()) {
                q.entry("java:/jms/queue/" + childKey);
            }
        });
    }
public EnhancedServer remoteConnection ( String name ) { return remoteConnection ( name , ( config ) -> { } ) ; } public EnhancedServer remoteConnection ( String name , RemoteConnection . Consumer config ) { return remoteConnection ( ( ) -> { RemoteConnection connection = new RemoteConnection ( name ) ; config . accept ( connection ) ; return connection ; } ) ; } public EnhancedServer remoteConnection ( RemoteConnection . Supplier supplier ) { RemoteConnection connection = supplier . get ( ) ; this . remoteConnections . add ( connection ) ; return this ; } public EnhancedServer enableRemote ( ) { enableHTTPConnections ( ) ; connectionFactory ( new ConnectionFactory < > ( "RemoteConnectionFactory" ) . connectors ( Collections . singletonList ( "http-connector" ) ) . entries ( "java:/RemoteConnectionFactory" , "java:jboss/exported/jms/RemoteConnectionFactory" ) ) ; return this ; } private EnhancedServer enableHTTPConnections ( ) { if ( this . subresources ( ) . acceptor ( ( "http-acceptor" ) ) != null ) { return this ; } httpAcceptor ( new HTTPAcceptor ( "http-acceptor" ) . httpListener ( "default" ) ) ; httpAcceptor ( new HTTPAcceptor ( "http-acceptor-throughput" ) . httpListener ( "default" ) . param ( "batch-delay" , "50" ) . param ( "direct-deliver" , "false" ) ) ; httpConnector ( new HTTPConnector ( HTTP_CONNECTOR ) . socketBinding ( "http" ) . endpoint ( "http-acceptor" ) ) ; httpConnector ( new HTTPConnector ( "http-connector-throughput" ) . socketBinding ( "http" ) . endpoint ( "http-acceptor-throughput" ) . param ( "batch-delay" , "50" ) ) ; return this ; } @ SuppressWarnings ( "unchecked" ) @ Override public EnhancedServer jmsQueue ( String childKey , JMSQueueConsumer config ) { return super . jmsQueue ( childKey , ( q ) -> { if ( config != null ) { config . accept ( q ) ; } if ( q . entries ( ) == null || q . entries ( ) . isEmpty ( ) ) { q . entry ( "java:/jms/queue/" + childKey ) ; } } ) ; }
Setup a default named remote connection to a remote message broker.

<p>By default, it sets up a connection
connecting to <code>localhost</code> at port <code>61616</code>.
The connection factory is named <code>java:/jms/<b>name</b></code>.</p>

@return This server.