Message loadMessage(MessageId messageId) throws IOException { Message msg = null; if (store != null) { // can be null for a temp q msg = store.getMessage(messageId); if (msg != null) { msg.setRegionDestination(this); } } return msg; }
@Override public boolean recoverMessage(Message message) throws Exception { message.setRegionDestination(Topic.this); try { msgContext.setMessageReference(message); if (subscription.matches(message, msgContext)) { subscription.add(message); } } catch (IOException e) { LOG.error("Failed to recover this message {}", message, e); } return true; }
@Override public synchronized LinkedList<MessageReference> pageInList(int maxItems) { LinkedList<MessageReference> result = new LinkedList<MessageReference>(); int count = 0; for (Iterator<MessageReference> i = memoryList.iterator(); i.hasNext() && count < maxItems;) { MessageReference ref = i.next(); ref.incrementReferenceCount(); result.add(ref); count++; } if (count < maxItems && !isDiskListEmpty()) { for (Iterator<MessageReference> i = new DiskIterator(); i.hasNext() && count < maxItems;) { Message message = (Message) i.next(); message.setRegionDestination(regionDestination); message.setMemoryUsage(this.getSystemUsage().getMemoryUsage()); message.incrementReferenceCount(); result.add(message); count++; } } return result; }
@Override public boolean recoverMessage(Message message) { recoveredAccumulator++; if ((recoveredAccumulator % 10000) == 0) { LOG.info("cursor for {} has recovered {} messages. {}% complete", new Object[]{ getActiveMQDestination().getQualifiedName(), recoveredAccumulator, new Integer((int) (recoveredAccumulator * 100 / totalMessageCount))}); } // Message could have expired while it was being // loaded.. message.setRegionDestination(Queue.this); if (message.isExpired() && broker.isExpired(message)) { toExpire.add(message); return true; } if (hasSpace()) { messagesLock.writeLock().lock(); try { try { messages.addMessageLast(message); } catch (Exception e) { LOG.error("Failed to add message to cursor", e); } } finally { messagesLock.writeLock().unlock(); } destinationStatistics.getMessages().increment(); return true; } return false; }
@Override public void duplicateFromStore(Message message, Subscription subscription) { ConnectionContext connectionContext = createConnectionContext(); getLog().warn("{}{}, redirecting {} for dlq processing", DUPLICATE_FROM_STORE_MSG_PREFIX, destination, message.getMessageId()); Throwable cause = new Throwable(DUPLICATE_FROM_STORE_MSG_PREFIX + destination); message.setRegionDestination(this); broker.getRoot().sendToDeadLetterQueue(connectionContext, message, null, cause); MessageAck messageAck = new MessageAck(message, MessageAck.POSION_ACK_TYPE, 1); messageAck.setPoisonCause(cause); try { acknowledge(connectionContext, subscription, messageAck, message); } catch (IOException e) { getLog().error("Failed to acknowledge duplicate message {} from {} with {}", message.getMessageId(), destination, messageAck); } }
for (DurableTopicSubscription sub : durableSubscribers.values()) { if (!sub.isActive()) { message.setRegionDestination(this); messageExpired(connectionContext, sub, message);
/** * @return the next pending message */ @Override public synchronized MessageReference next() { MessageReference reference = iter.next(); last = reference; if (!isDiskListEmpty()) { // got from disk reference.getMessage().setRegionDestination(regionDestination); reference.getMessage().setMemoryUsage(this.getSystemUsage().getMemoryUsage()); } reference.incrementReferenceCount(); return reference; }
private boolean isDestinationDLQ(Message message) { DeadLetterStrategy deadLetterStrategy; Message tmp; Destination regionDestination = (Destination) message.getRegionDestination(); if (message != null && regionDestination != null) { deadLetterStrategy = regionDestination.getDeadLetterStrategy(); if (deadLetterStrategy != null && message.getOriginalDestination() != null) { // Cheap copy, since we only need two fields tmp = new ActiveMQMessage(); tmp.setDestination(message.getOriginalDestination()); tmp.setRegionDestination(regionDestination); // Determine if we are headed for a DLQ ActiveMQDestination deadLetterDestination = deadLetterStrategy.getDeadLetterQueueFor(tmp, null); if (deadLetterDestination.equals(message.getDestination())) { return true; } } } return false; } }
public synchronized boolean recoverMessage(Message message, boolean cached) throws Exception { boolean recovered = false; message.setRegionDestination(regionDestination); if (recordUniqueId(message.getMessageId())) { if (!cached) {
regionDest = getBaseDestination((Destination) regionBroker.getDestinations(newDestination).toArray()[0]); copy.setRegionDestination(regionDest); sub.addRecoveredMessage(context, newDestination.isQueue() ? new IndirectMessageReference(copy) : copy);
&& !context.isInRecoveryMode(); message.setRegionDestination(this);
message.setRegionDestination(this); ProducerState state = producerExchange.getProducerState(); if (state == null) {
Message loadMessage(MessageId messageId) throws IOException { Message msg = null; if (store != null) { // can be null for a temp q msg = store.getMessage(messageId); if (msg != null) { msg.setRegionDestination(this); } } return msg; }
Message loadMessage(MessageId messageId) throws IOException { Message msg = null; if (store != null) { // can be null for a temp q msg = store.getMessage(messageId); if (msg != null) { msg.setRegionDestination(this); } } return msg; }
Message loadMessage(MessageId messageId) throws IOException { Message msg = null; if (store != null) { // can be null for a temp q msg = store.getMessage(messageId); if (msg != null) { msg.setRegionDestination(this); } } return msg; }
Message loadMessage(MessageId messageId) throws IOException { Message msg = null; if (store != null) { // can be null for a temp q msg = store.getMessage(messageId); if (msg != null) { msg.setRegionDestination(this); } } return msg; }
@Override public boolean recoverMessage(Message message) throws Exception { message.setRegionDestination(Topic.this); try { msgContext.setMessageReference(message); if (subscription.matches(message, msgContext)) { subscription.add(message); } } catch (IOException e) { LOG.error("Failed to recover this message {}", message, e); } return true; }
public boolean recoverMessage(Message message) throws Exception { message.setRegionDestination(Topic.this); try { msgContext.setMessageReference(message); if (subscription.matches(message, msgContext)) { subscription.add(message); } } catch (IOException e) { LOG.error("Failed to recover this message " + message); } return true; }
@Override public boolean recoverMessage(Message message) throws Exception { message.setRegionDestination(Topic.this); try { msgContext.setMessageReference(message); if (subscription.matches(message, msgContext)) { subscription.add(message); } } catch (IOException e) { LOG.error("Failed to recover this message {}", message, e); } return true; }
@Override public boolean recoverMessage(Message message) throws Exception { message.setRegionDestination(Topic.this); try { msgContext.setMessageReference(message); if (subscription.matches(message, msgContext)) { subscription.add(message); } } catch (IOException e) { LOG.error("Failed to recover this message {}", message, e); } return true; }