@Override public void messageReceived(PreShardSyncedFlushRequest request, TransportChannel channel) throws Exception { channel.sendResponse(performPreSyncedFlush(request)); } }
if(transportChannel.getChannelType() == null) { throw new RuntimeException("Can not determine channel type (null)"); if(!transportChannel.getChannelType().equals("direct") && !transportChannel.getChannelType().equals("netty")) { throw new RuntimeException("Unknown channel type "+transportChannel.getChannelType()); getThreadContext().putTransient(ConfigConstants.SG_CHANNEL_TYPE, transportChannel.getChannelType()); getThreadContext().putTransient(ConfigConstants.SG_ACTION_NAME, task.getAction()); if(transportChannel.getChannelType().equals("direct")) { final String userHeader = getThreadContext().getHeader(ConfigConstants.SG_USER_HEADER); getThreadContext().putHeader("_sg_trace"+System.currentTimeMillis()+"#"+UUID.randomUUID().toString(), Thread.currentThread().getName()+" DIR -> "+transportChannel.getChannelType()+" "+getThreadContext().getHeaders()); log.error("Internal or shard requests ("+task.getAction()+") not allowed from a non-server node for transport type "+transportChannel.getChannelType()); transportChannel.sendResponse(new ElasticsearchSecurityException( "Internal or shard requests not allowed from a non-server node for transport type "+transportChannel.getChannelType())); return; "No SSL client certificates found for transport type "+transportChannel.getChannelType()+". Search Guard needs the Search Guard SSL plugin to be installed"); auditLog.logSSLException(request, ex, task.getAction(), task); log.error("No SSL client certificates found for transport type "+transportChannel.getChannelType()+". Search Guard needs the Search Guard SSL plugin to be installed"); transportChannel.sendResponse(ex); return; } else { auditLog.logBadHeaders(request, task.getAction(), task); log.error(exception); transportChannel.sendResponse(exception);
@Override public String getProfileName() { return channel.getProfileName(); }
@Override public void messageReceived(Version0Request request, TransportChannel channel) throws Exception { assertThat(request.value1, equalTo(1)); Version0Response response = new Version0Response(); response.value1 = 1; channel.sendResponse(response); assertEquals(version0, channel.getVersion()); } });
@Override public String getChannelType() { return channel.getChannelType(); }
@Override public Version getVersion() { return channel.getVersion(); }
@Override public long getRequestId() { return channel.getRequestId(); }
@Override public String action() { return channel.action(); }
@Override public void messageReceived(Version1Request request, TransportChannel channel) throws Exception { assertThat(request.value1, equalTo(1)); assertThat(request.value2, equalTo(0)); // not set, coming from service A Version1Response response = new Version1Response(); response.value1 = 1; response.value2 = 2; channel.sendResponse(response); assertEquals(version0, channel.getVersion()); } });
public void processMessageReceived(Request request, TransportChannel channel) throws Exception { final Task task = taskManager.register(channel.getChannelType(), action, request); if (task == null) { handler.messageReceived(request, channel); } else { boolean success = false; try { handler.messageReceived(request, new TaskTransportChannel(taskManager, task, channel), task); success = true; } finally { if (success == false) { taskManager.unregister(task); } } } }
@Override public Version getVersion() { return channel.getVersion(); } }
@Override public long getRequestId() { return channel.getRequestId(); }
@Override public String action() { return channel.action(); }
@Override public void messageReceived(InFlightOpsRequest request, TransportChannel channel) throws Exception { channel.sendResponse(performInFlightOps(request)); } }
channel.sendResponse(exception); throw exception; if (!"netty".equals(channel.getChannelType())) { //netty4 messageReceivedDecorate(request, actualHandler, channel, task); return; nettyChannel = (NettyTcpChannel) inner; } else { throw new Exception("Invalid channel of type "+channel.getClass()+ " ("+channel.getChannelType()+")"); channel.sendResponse(exception); throw exception; channel.sendResponse(exception); throw exception; errorHandler.logError(e, request, action, task, 0); final Exception exception = ExceptionsHelper.convertToElastic(e); channel.sendResponse(exception); throw exception; } catch (final Exception e) {
Version0Response response = new Version0Response(); response.value1 = 1; channel.sendResponse(response); assertEquals(version0, channel.getVersion()); });
@Override public String getChannelType() { return channel.getChannelType(); }
@Override public String getProfileName() { return channel.getProfileName(); }
@Override public Version getVersion() { return channel.getVersion(); }
@Override public void messageReceived(final StartRecoveryRequest request, final TransportChannel channel) throws Exception { RecoveryResponse response = recover(request); channel.sendResponse(response); } }