Source:
public boolean receive(CarbonMessage carbonMessage, CarbonCallback carbonCallback) { executorService.execute(() -> { String protocolName = (String) carbonMessage.getProperty(Constants.PROTOCOL); if (Constants.PROTOCOL_NAME.equalsIgnoreCase(protocolName)) { MicroservicesRegistryImpl currentMicroservicesRegistry = DataHolder.getInstance().getMicroservicesRegistries() .get(carbonMessage.getProperty(MSF4JConstants.CHANNEL_ID)); Request request = new Request(carbonMessage); request.setSessionManager(currentMicroservicesRegistry.getSessionManager()); Response response = new Response(carbonCallback, request); try { dispatchMethod(currentMicroservicesRegistry, request, response); } catch (HandlerException e) { handleHandlerException(e, carbonCallback); } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); if (targetException instanceof HandlerException) { handleHandlerException((HandlerException) targetException, carbonCallback); } else { handleThrowable(currentMicroservicesRegistry, targetException, carbonCallback, request); } } catch (InterceptorException e) { log.warn("Interceptors threw an exception", e); carbonCallback.done(HttpUtil.createTextResponse( javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), HttpUtil.EMPTY_BODY)); } catch (Throwable t) { handleThrowable(currentMicroservicesRegistry, t, carbonCallback, request); } finally { carbonMessage.release(); } } else if (Constants.WEBSOCKET_PROTOCOL.equalsIgnoreCase(protocolName)) { log.info("WebSocketMessage Received"); EndpointsRegistryImpl endpointsRegistry = EndpointsRegistryImpl.getInstance(); PatternPathRouter.RoutableDestination<Object> routableEndpoint = null; try { routableEndpoint = endpointsRegistry.getRoutableEndpoint(carbonMessage); dispatchWebSocketMethod(routableEndpoint, carbonMessage); } catch (WebSocketEndpointAnnotationException e) { log.error(e.toString()); } } else { log.error("Cannot find the protocol to dispatch."); } }); return true; }

Target:
public boolean receive(CarbonMessage carbonMessage, CarbonCallback carbonCallback) { executorService.execute(() -> { String protocolName = (String) carbonMessage.getProperty(Constants.PROTOCOL); if (Constants.HTTP_PROTOCOL_NAME.equalsIgnoreCase(protocolName)) { MicroservicesRegistryImpl currentMicroservicesRegistry = DataHolder.getInstance().getMicroservicesRegistries() .get(carbonMessage.getProperty(MSF4JConstants.CHANNEL_ID)); Request request = new Request(carbonMessage); request.setSessionManager(currentMicroservicesRegistry.getSessionManager()); Response response = new Response(carbonCallback, request); try { dispatchMethod(currentMicroservicesRegistry, request, response); } catch (HandlerException e) { handleHandlerException(e, carbonCallback); } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); if (targetException instanceof HandlerException) { handleHandlerException((HandlerException) targetException, carbonCallback); } else { handleThrowable(currentMicroservicesRegistry, targetException, carbonCallback, request); } } catch (InterceptorException e) { log.warn("Interceptors threw an exception", e); carbonCallback.done(HttpUtil.createTextResponse( javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), HttpUtil.EMPTY_BODY)); } catch (Throwable t) { handleThrowable(currentMicroservicesRegistry, t, carbonCallback, request); } finally { carbonMessage.release(); } } else if (Constants.WEBSOCKET_PROTOCOL_NAME.equalsIgnoreCase(protocolName)) { EndpointsRegistryImpl endpointsRegistry = EndpointsRegistryImpl.getInstance(); PatternPathRouter.RoutableDestination<Object> routableEndpoint = null; Session session = (Session) carbonMessage.getProperty(Constants.WEBSOCKET_SESSION); String uri = (String) carbonMessage.getProperty(Constants.TO); try { routableEndpoint = endpointsRegistry.getRoutableEndpoint(uri); dispatchWebSocketMethod(routableEndpoint, carbonMessage); } catch (WebSocketEndpointAnnotationException e) { handleError(e, routableEndpoint, session); } } else { log.error("Cannot find the protocol to dispatch."); } }); return true; }