use of org.wso2.transport.http.netty.contract.ServerConnector in project ballerina by ballerina-lang.
the class StartWebSubSubscriberServiceEndpoint method execute.
@Override
public void execute(Context context) {
Struct subscriberServiceEndpoint = BLangConnectorSPIUtil.getConnectorEndpointStruct(context);
Struct serviceEndpoint = ConnectorSPIModelHelper.createStruct((BStruct) ((BStruct) (subscriberServiceEndpoint.getVMValue())).getRefField(1));
ServerConnector serverConnector = getServerConnector(serviceEndpoint);
if (isHTTPTraceLoggerEnabled()) {
try {
((BLogManager) BLogManager.getLogManager()).setHttpTraceLogHandler();
} catch (IOException e) {
throw new BallerinaConnectorException("Invalid HTTP trace log parameters found.", e);
} catch (TraceLogConfigurationException e) {
throw new BallerinaConnectorException("Unsupported HTTP trace log configuration. " + e.getMessage(), e);
}
}
ServerConnectorFuture serverConnectorFuture = serverConnector.start();
WebSubServicesRegistry webSubServicesRegistry = (WebSubServicesRegistry) serviceEndpoint.getNativeData(WebSubSubscriberConstants.WEBSUB_SERVICE_REGISTRY);
HashSet<FilterHolder> filterHolder = getFilters(serviceEndpoint);
serverConnectorFuture.setHttpConnectorListener(new BallerinaWebSubConnectionListener(webSubServicesRegistry, filterHolder));
serverConnectorFuture.setPortBindingEventListener(new HttpConnectorPortBindingListener());
context.setReturnValues();
}
Aggregations