@Override public void onResponse(Command response) { if (ExceptionResponse.DATA_STRUCTURE_TYPE == response.getDataStructureType()) { if (tracked.getDataStructureType() == ConsumerInfo.DATA_STRUCTURE_TYPE) { processRemoveConsumer(((ConsumerInfo) tracked).getConsumerId(), 0l); } else if (tracked.getDataStructureType() == ProducerInfo.DATA_STRUCTURE_TYPE) { processRemoveProducer(((ProducerInfo) tracked).getProducerId()); } } } }
/** * @param command * @return */ private boolean isFanoutCommand(Command command) { if (command.isMessage()) { if (fanOutQueues) { return true; } return ((Message) command).getDestination().isTopic(); } if (command.getDataStructureType() == ConsumerInfo.DATA_STRUCTURE_TYPE || command.getDataStructureType() == RemoveInfo.DATA_STRUCTURE_TYPE) { return false; } return true; }
super.onCommand(command); return; } else if (command.getDataStructureType() == ReplayCommand.DATA_STRUCTURE_TYPE) { replayCommands((ReplayCommand)command); return;
} else { if (TRANSPORTLOG.isDebugEnabled()) { TRANSPORTLOG.debug("Unexpected exception on asyncDispatch, command of type: " + command.getDataStructureType(), e);
public void onCommand(Object o) { Command command = (Command)o; byte type = command.getDataStructureType(); if (type == PartialCommand.DATA_STRUCTURE_TYPE || type == LastPartialCommand.DATA_STRUCTURE_TYPE) { PartialCommand header = (PartialCommand)command; byte[] partialData = header.getData(); try { out.write(partialData); } catch (IOException e) { getTransportListener().onException(e); } if (type == LastPartialCommand.DATA_STRUCTURE_TYPE) { try { byte[] fullData = out.toByteArray(); out.reset(); DataInputStream dataIn = new DataInputStream(new ByteArrayInputStream(fullData)); Command completeCommand = (Command)wireFormat.unmarshal(dataIn); LastPartialCommand lastCommand = (LastPartialCommand)command; lastCommand.configure(completeCommand); getTransportListener().onCommand(completeCommand); } catch (IOException e) { LOG.warn("Failed to unmarshal partial command: " + command); getTransportListener().onException(e); } } } else { getTransportListener().onCommand(command); } }
} else { if (isDuplex()) { LOG.trace("{} duplex command type: {}", configuration.getBrokerName(), command.getDataStructureType()); if (command.isMessage()) { final ActiveMQMessage message = (ActiveMQMessage) command; switch (command.getDataStructureType()) { case ConnectionInfo.DATA_STRUCTURE_TYPE: if (duplexInitiatingConnection != null && duplexInitiatingConnectionInfoReceived.compareAndSet(false, true)) { switch (command.getDataStructureType()) { case KeepAliveInfo.DATA_STRUCTURE_TYPE: case WireFormatInfo.DATA_STRUCTURE_TYPE:
serviceLocalException(ce.getException()); } else { switch (command.getDataStructureType()) { case WireFormatInfo.DATA_STRUCTURE_TYPE: break;
@Override public void onResponse(Command response) { if (ExceptionResponse.DATA_STRUCTURE_TYPE == response.getDataStructureType()) { if (tracked.getDataStructureType() == ConsumerInfo.DATA_STRUCTURE_TYPE) { processRemoveConsumer(((ConsumerInfo) tracked).getConsumerId(), 0l); } else if (tracked.getDataStructureType() == ProducerInfo.DATA_STRUCTURE_TYPE) { processRemoveProducer(((ProducerInfo) tracked).getProducerId()); } } } }
@Override public void onResponse(Command response) { if (ExceptionResponse.DATA_STRUCTURE_TYPE == response.getDataStructureType()) { if (tracked.getDataStructureType() == ConsumerInfo.DATA_STRUCTURE_TYPE) { processRemoveConsumer(((ConsumerInfo) tracked).getConsumerId(), 0l); } else if (tracked.getDataStructureType() == ProducerInfo.DATA_STRUCTURE_TYPE) { processRemoveProducer(((ProducerInfo) tracked).getProducerId()); } } } }
@Override public void onResponse(Command response) { if (ExceptionResponse.DATA_STRUCTURE_TYPE == response.getDataStructureType()) { if (tracked.getDataStructureType() == ConsumerInfo.DATA_STRUCTURE_TYPE) { processRemoveConsumer(((ConsumerInfo) tracked).getConsumerId(), 0l); } else if (tracked.getDataStructureType() == ProducerInfo.DATA_STRUCTURE_TYPE) { processRemoveProducer(((ProducerInfo) tracked).getProducerId()); } } } }
/** * @param command * @return */ private boolean isFanoutCommand(Command command) { if (command.isMessage()) { if (fanOutQueues) { return true; } return ((Message) command).getDestination().isTopic(); } if (command.getDataStructureType() == ConsumerInfo.DATA_STRUCTURE_TYPE || command.getDataStructureType() == RemoveInfo.DATA_STRUCTURE_TYPE) { return false; } return true; }
/** * @param command * @return */ private boolean isFanoutCommand(Command command) { if (command.isMessage()) { if (fanOutQueues) { return true; } return ((Message) command).getDestination().isTopic(); } if (command.getDataStructureType() == ConsumerInfo.DATA_STRUCTURE_TYPE || command.getDataStructureType() == RemoveInfo.DATA_STRUCTURE_TYPE) { return false; } return true; }
/** * @param command * @return */ private boolean isFanoutCommand(Command command) { if (command.isMessage()) { if (fanOutQueues) { return true; } return ((Message) command).getDestination().isTopic(); } if (command.getDataStructureType() == ConsumerInfo.DATA_STRUCTURE_TYPE || command.getDataStructureType() == RemoveInfo.DATA_STRUCTURE_TYPE) { return false; } return true; }
/** * @param command * @return */ private boolean isFanoutCommand(Command command) { if (command.isMessage()) { if( fanOutQueues ) { return true; } return ((Message)command).getDestination().isTopic(); } if (command.getDataStructureType() == ConsumerInfo.DATA_STRUCTURE_TYPE || command.getDataStructureType() == RemoveInfo.DATA_STRUCTURE_TYPE) { return false; } return true; }
protected void processCommand(Object o) throws Exception { Command command = (Command) o; if (command.isResponse()) { LOG.error("Unexpected response " + command); } else if (command.isMessageDispatch()) { MessageDispatch messageDispatch = (MessageDispatch) command; ConsumerId consumerId = messageDispatch.getConsumerId(); MultiplexerInput input = consumerIdMultiplexerInputMap.get(consumerId); if (input != null) { input.oneway(messageDispatch); } else { LOG.debug("Couldn't find MultiplexerInput for consumerId:" + consumerId); } } else if (command.isBrokerInfo() || command.isWireFormatInfo()) { //not a lot to do with this } else if (command.getClass() == ConnectionError.class) { ConnectionError ce = (ConnectionError) command; onFailure(ce.getException()); } else { switch (command.getDataStructureType()) { case KeepAliveInfo.DATA_STRUCTURE_TYPE: case ShutdownInfo.DATA_STRUCTURE_TYPE: case ConnectionControl.DATA_STRUCTURE_TYPE: break; default: LOG.warn("Unexpected remote command: {}", command); } } }
public void onCommand(Object o) { Command command = (Command)o; byte type = command.getDataStructureType(); if (type == PartialCommand.DATA_STRUCTURE_TYPE || type == LastPartialCommand.DATA_STRUCTURE_TYPE) { PartialCommand header = (PartialCommand)command; byte[] partialData = header.getData(); try { out.write(partialData); } catch (IOException e) { getTransportListener().onException(e); } if (type == LastPartialCommand.DATA_STRUCTURE_TYPE) { try { byte[] fullData = out.toByteArray(); out.reset(); DataInputStream dataIn = new DataInputStream(new ByteArrayInputStream(fullData)); Command completeCommand = (Command)wireFormat.unmarshal(dataIn); LastPartialCommand lastCommand = (LastPartialCommand)command; lastCommand.configure(completeCommand); getTransportListener().onCommand(completeCommand); } catch (IOException e) { LOG.warn("Failed to unmarshal partial command: " + command); getTransportListener().onException(e); } } } else { getTransportListener().onCommand(command); } }
public void doConsume(Object o) { inactivityMonitor.startRead(); Command command = (Command) o; if (command.isWireFormatInfo()) { WireFormatInfo info = (WireFormatInfo) command; negotiate(info); } if (command.getDataStructureType() == KeepAliveInfo.DATA_STRUCTURE_TYPE) { KeepAliveInfo keepAliveInfo = (KeepAliveInfo) command; inactivityMonitor.processKeepAliveReceived(keepAliveInfo); } else { super.doConsume(command); } inactivityMonitor.finishedRead(); }
public void onCommand(Object o) { Command command = (Command)o; byte type = command.getDataStructureType(); if (type == PartialCommand.DATA_STRUCTURE_TYPE || type == LastPartialCommand.DATA_STRUCTURE_TYPE) { PartialCommand header = (PartialCommand)command; byte[] partialData = header.getData(); try { out.write(partialData); } catch (IOException e) { getTransportListener().onException(e); } if (type == LastPartialCommand.DATA_STRUCTURE_TYPE) { try { byte[] fullData = out.toByteArray(); out.reset(); DataInputStream dataIn = new DataInputStream(new ByteArrayInputStream(fullData)); Command completeCommand = (Command)wireFormat.unmarshal(dataIn); LastPartialCommand lastCommand = (LastPartialCommand)command; lastCommand.configure(completeCommand); getTransportListener().onCommand(completeCommand); } catch (IOException e) { LOG.warn("Failed to unmarshal partial command: " + command); getTransportListener().onException(e); } } } else { getTransportListener().onCommand(command); } }
public void doConsume(Object o) { inactivityMonitor.startRead(); Command command = (Command) o; if (command.isWireFormatInfo()) { WireFormatInfo info = (WireFormatInfo) command; negotiate(info); } if (command.getDataStructureType() == KeepAliveInfo.DATA_STRUCTURE_TYPE) { KeepAliveInfo keepAliveInfo = (KeepAliveInfo) command; inactivityMonitor.processKeepAliveReceived(keepAliveInfo); } else { super.doConsume(command); } inactivityMonitor.finishedRead(); }
protected void serviceRemoteCommand(Command command) { try { if (command.isMessageDispatch()) { MessageDispatch md = (MessageDispatch)command; command = md.getMessage(); } if (command.getDataStructureType() == CommandTypes.SHUTDOWN_INFO) { LOG.warn("The Master has shutdown"); shutDown(); } else { boolean responseRequired = command.isResponseRequired(); int commandId = command.getCommandId(); if (responseRequired) { Response response = (Response)localBroker.request(command); response.setCorrelationId(commandId); remoteBroker.oneway(response); } else { localBroker.oneway(command); } } } catch (IOException e) { serviceRemoteException(e); } }