/** * Completes the two phase tracking operation for a command that is sent on the wire. Once * the command is sent successfully to complete the tracking operation or otherwise update * the state of the tracker. * * @param command * The command that was previously provided to the track method. */ public void trackBack(Command command) { if (command != null) { if (trackMessages && command.isMessage()) { Message message = (Message) command; if (message.getTransactionId()==null) { currentCacheSize = currentCacheSize + message.getSize(); } } else if (command instanceof MessagePull) { // We only track one MessagePull per consumer so only add to cache size // when the command has been marked as tracked. if (((MessagePull)command).isTracked()) { // just needs to be a rough estimate of size, ~4 identifiers currentCacheSize += MESSAGE_PULL_SIZE; } } } }
if (command.isMessage() && timeout > 0 && (end - start > timeout)) { timedout = true; LOG.info("Failover timed out after {} ms", (end - start));
if (isDuplex()) { LOG.trace("{} duplex command type: {}", configuration.getBrokerName(), command.getDataStructureType()); if (command.isMessage()) { final ActiveMQMessage message = (ActiveMQMessage) command; if (NetworkBridgeFilter.isAdvisoryInterpretedByNetworkBridge(message)) {
public ActiveMQDestination getDestination() { if (command.isMessage()) { return ((Message) command).getDestination(); } if (command.isMessageDispatch()) { return ((MessageDispatch) command).getDestination(); } if (command.isMessageAck()) { return ((MessageAck) command).getDestination(); } if (command instanceof ConsumerInfo) { return ((ConsumerInfo) command).getDestination(); } return null; }
public void setDestination(ActiveMQDestination destination) { if (command.isMessage()) { Message message = (Message) command; if (message.getOriginalDestination() == null) { message.setOriginalDestination(message.getDestination()); } message.setDestination(destination); } if (command.isMessageDispatch()) { MessageDispatch messageDispatch = (MessageDispatch) command; Message message = messageDispatch.getMessage(); if (message.getOriginalDestination() == null) { message.setOriginalDestination(message.getDestination()); } message.setDestination(destination); messageDispatch.setDestination(destination); } if (command.isMessageAck()) { ((MessageAck) command).setDestination(destination); } if (command instanceof ConsumerInfo) { ((ConsumerInfo) command).setDestination(destination); } }
protected void populateInitialHeaders(Map<String, Object> map) { Message message = null; if (command.isMessage()) { message = (Message) this.command; } if (command.isMessageDispatch()) { message = ((MessageDispatch) command).getMessage(); } if (message != null) { map.put("JMSCorrelationID", message.getCorrelationId()); map.put("JMSDestination", message.getDestination()); map.put("JMSExpiration", message.getExpiration()); map.put("JMSMessageID", message.getMessageId().toString()); map.put("JMSPriority", message.getPriority()); map.put("JMSRedelivered", message.isRedelivered()); map.put("JMSTimestamp", message.getTimestamp()); map.put("JMSReplyTo", message.getReplyTo()); map.put("JMSType", message.getType()); map.put("JMSXGroupID", message.getGroupID()); map.put("JMSXGroupSeq", message.getGroupSequence()); map.put("JMSXUserID", message.getUserID()); } } }
public void restore(Transport transport) throws IOException { // Restore the connections. for (Iterator<ConnectionState> iter = connectionStates.values().iterator(); iter.hasNext();) { ConnectionState connectionState = iter.next(); connectionState.getInfo().setFailoverReconnect(true); if (LOG.isDebugEnabled()) { LOG.debug("conn: " + connectionState.getInfo().getConnectionId()); } transport.oneway(connectionState.getInfo()); restoreTempDestinations(transport, connectionState); if (restoreSessions) { restoreSessions(transport, connectionState); } if (restoreTransaction) { restoreTransactions(transport, connectionState); } } // now flush messages and MessagePull commands. for (Command msg : messageCache.values()) { if (LOG.isDebugEnabled()) { LOG.debug("command: " + (msg.isMessage() ? ((Message) msg).getMessageId() : msg)); } transport.oneway(msg); } }
} else { if (isDuplex()) { if (command.isMessage()) { ActiveMQMessage message = (ActiveMQMessage) command; if (AdvisorySupport.isConsumerAdvisoryTopic(message.getDestination())
/** * @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; }
public void trackBack(Command command) { if (command != null) { if (trackMessages && command.isMessage()) { Message message = (Message) command; if (message.getTransactionId()==null) { currentCacheSize = currentCacheSize + message.getSize(); } } else if (command instanceof MessagePull) { // just needs to be a rough estimate of size, ~4 identifiers currentCacheSize += 400; } } }
public void restore(Transport transport) throws IOException { // Restore the connections. for (Iterator<ConnectionState> iter = connectionStates.values().iterator(); iter.hasNext();) { ConnectionState connectionState = iter.next(); connectionState.getInfo().setFailoverReconnect(true); if (LOG.isDebugEnabled()) { LOG.debug("conn: " + connectionState.getInfo().getConnectionId()); } transport.oneway(connectionState.getInfo()); restoreTempDestinations(transport, connectionState); if (restoreSessions) { restoreSessions(transport, connectionState); } if (restoreTransaction) { restoreTransactions(transport, connectionState); } } // now flush messages and MessagePull commands. for (Command msg : messageCache.values()) { if (LOG.isDebugEnabled()) { LOG.debug("command: " + (msg.isMessage() ? ((Message) msg).getMessageId() : msg)); } transport.oneway(msg); } }
public void restore(Transport transport) throws IOException { // Restore the connections. for (Iterator<ConnectionState> iter = connectionStates.values().iterator(); iter.hasNext();) { ConnectionState connectionState = iter.next(); connectionState.getInfo().setFailoverReconnect(true); if (LOG.isDebugEnabled()) { LOG.debug("conn: " + connectionState.getInfo().getConnectionId()); } transport.oneway(connectionState.getInfo()); restoreTempDestinations(transport, connectionState); if (restoreSessions) { restoreSessions(transport, connectionState); } if (restoreTransaction) { restoreTransactions(transport, connectionState); } } // now flush messages and MessagePull commands. for (Command msg : messageCache.values()) { if (LOG.isDebugEnabled()) { LOG.debug("command: " + (msg.isMessage() ? ((Message) msg).getMessageId() : msg)); } transport.oneway(msg); } }
public void restore(Transport transport) throws IOException { // Restore the connections. for (Iterator<ConnectionState> iter = connectionStates.values().iterator(); iter.hasNext();) { ConnectionState connectionState = iter.next(); connectionState.getInfo().setFailoverReconnect(true); if (LOG.isDebugEnabled()) { LOG.debug("conn: " + connectionState.getInfo().getConnectionId()); } transport.oneway(connectionState.getInfo()); restoreTempDestinations(transport, connectionState); if (restoreSessions) { restoreSessions(transport, connectionState); } if (restoreTransaction) { restoreTransactions(transport, connectionState); } } // now flush messages and MessagePull commands. for (Command msg : messageCache.values()) { if (LOG.isDebugEnabled()) { LOG.debug("command: " + (msg.isMessage() ? ((Message) msg).getMessageId() : msg)); } transport.oneway(msg); } }
/** * Completes the two phase tracking operation for a command that is sent on the wire. Once * the command is sent successfully to complete the tracking operation or otherwise update * the state of the tracker. * * @param command * The command that was previously provided to the track method. */ public void trackBack(Command command) { if (command != null) { if (trackMessages && command.isMessage()) { Message message = (Message) command; if (message.getTransactionId()==null) { currentCacheSize = currentCacheSize + message.getSize(); } } else if (command instanceof MessagePull) { // We only track one MessagePull per consumer so only add to cache size // when the command has been marked as tracked. if (((MessagePull)command).isTracked()) { // just needs to be a rough estimate of size, ~4 identifiers currentCacheSize += MESSAGE_PULL_SIZE; } } } }
/** * Completes the two phase tracking operation for a command that is sent on the wire. Once * the command is sent successfully to complete the tracking operation or otherwise update * the state of the tracker. * * @param command * The command that was previously provided to the track method. */ public void trackBack(Command command) { if (command != null) { if (trackMessages && command.isMessage()) { Message message = (Message) command; if (message.getTransactionId()==null) { currentCacheSize = currentCacheSize + message.getSize(); } } else if (command instanceof MessagePull) { // We only track one MessagePull per consumer so only add to cache size // when the command has been marked as tracked. if (((MessagePull)command).isTracked()) { // just needs to be a rough estimate of size, ~4 identifiers currentCacheSize += MESSAGE_PULL_SIZE; } } } }
/** * Completes the two phase tracking operation for a command that is sent on the wire. Once * the command is sent successfully to complete the tracking operation or otherwise update * the state of the tracker. * * @param command * The command that was previously provided to the track method. */ public void trackBack(Command command) { if (command != null) { if (trackMessages && command.isMessage()) { Message message = (Message) command; if (message.getTransactionId()==null) { currentCacheSize = currentCacheSize + message.getSize(); } } else if (command instanceof MessagePull) { // We only track one MessagePull per consumer so only add to cache size // when the command has been marked as tracked. if (((MessagePull)command).isTracked()) { // just needs to be a rough estimate of size, ~4 identifiers currentCacheSize += MESSAGE_PULL_SIZE; } } } }
/** * @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; }