Search in sources :

Example 1 with Connector

use of io.gravitee.gateway.api.Connector in project gravitee-gateway by gravitee-io.

the class DefaultEndpointLifecycleManager method start.

public void start(io.gravitee.definition.model.Endpoint endpoint) {
    try {
        logger.info("Create new endpoint: name[{}] type[{}] target[{}]", endpoint.getName(), endpoint.getType(), endpoint.getTarget());
        if (endpoint.getType() == EndpointType.HTTP) {
            // TODO: Later, when multiple endpoint type will be supported,
            // select the connector factory according to the endpoint type
            Connector connector = applicationContext.getBean(Connector.class, endpoint);
            connector.start();
            HttpEndpoint httpEndpoint = new HttpEndpoint((io.gravitee.definition.model.endpoint.HttpEndpoint) endpoint, connector);
            endpoints.add(httpEndpoint);
            endpointsByName.put(endpoint.getName(), httpEndpoint);
            endpointsTarget.put(endpoint.getName(), endpoint.getTarget());
        }
    } catch (Exception ex) {
        logger.error("Unexpected error while creating endpoint connector", ex);
    }
}
Also used : Connector(io.gravitee.gateway.api.Connector) HttpEndpoint(io.gravitee.gateway.http.core.endpoint.HttpEndpoint)

Aggregations

Connector (io.gravitee.gateway.api.Connector)1 HttpEndpoint (io.gravitee.gateway.http.core.endpoint.HttpEndpoint)1