@Override public void execute() throws Exception { // Checkpoint the acknowledged messages. Iterator<SubscriptionKey> iterator = cpAckedLastAckLocations.keySet().iterator(); while (iterator.hasNext()) { SubscriptionKey subscriptionKey = iterator.next(); MessageId identity = cpAckedLastAckLocations.get(subscriptionKey); MessageAck ack = new MessageAck(); ack.setMessageID(identity); longTermStore.acknowledge(transactionTemplate.getContext(), subscriptionKey.clientId, subscriptionKey.subscriptionName, identity, ack); } } });
protected void removeMessage(ConnectionContext c, Subscription subs, QueueMessageReference r) throws IOException { MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.STANDARD_ACK_TYPE); ack.setDestination(destination); ack.setMessageID(r.getMessageId()); removeMessage(c, subs, r, ack); }
/** * store will have a pending ack for all durables, irrespective of the * selector so we need to ack if node is un-matched */ @Override public void unmatched(MessageReference node) throws IOException { MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.UNMATCHED_ACK_TYPE); ack.setMessageID(node.getMessageId()); Destination regionDestination = (Destination) node.getRegionDestination(); regionDestination.acknowledge(this.getContext(), this, ack, node); }
@Override public void messageExpired(ConnectionContext context, Subscription subs, MessageReference reference) { broker.messageExpired(context, reference, subs); // AMQ-2586: Better to leave this stat at zero than to give the user // misleading metrics. // destinationStatistics.getMessages().decrement(); destinationStatistics.getExpired().increment(); MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.STANDARD_ACK_TYPE); ack.setDestination(destination); ack.setMessageID(reference.getMessageId()); try { if (subs instanceof DurableTopicSubscription) { ((DurableTopicSubscription)subs).removePending(reference); } acknowledge(context, subs, ack, reference); } catch (Exception e) { LOG.error("Failed to remove expired Message from the store ", e); } }
public void remove(SubscriptionView view, String messageId) throws Exception { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { final Destination topic = getTopicRegion().getDestinationMap().get(destination); final MessageAck messageAck = new MessageAck(); messageAck.setMessageID(new MessageId(messageId)); messageAck.setDestination(destination); topic.getMessageStore().removeMessage(brokerService.getAdminConnectionContext(), messageAck); // if sub is active, remove from cursor if (view.subscription instanceof DurableTopicSubscription) { final DurableTopicSubscription durableTopicSubscription = (DurableTopicSubscription) view.subscription; final MessageReference messageReference = new NullMessageReference(); messageReference.getMessage().setMessageId(messageAck.getFirstMessageId()); durableTopicSubscription.getPending().remove(messageReference); } } else { throw new IllegalStateException("can't determine topic for sub:" + view); } }
public MessageAck onStompMessageNack(String messageId, TransactionId transactionId) throws ProtocolException { MessageId msgId = new MessageId(messageId); if (!dispatchedMessage.containsKey(msgId)) { return null; } MessageAck ack = new MessageAck(); ack.setDestination(consumerInfo.getDestination()); ack.setConsumerId(consumerInfo.getConsumerId()); ack.setAckType(MessageAck.POSION_ACK_TYPE); ack.setMessageID(msgId); if (transactionId != null) { unconsumedMessage.add(dispatchedMessage.get(msgId)); ack.setTransactionId(transactionId); } dispatchedMessage.remove(msgId); return ack; }
public MessageAck onStompMessageNack(String messageId, TransactionId transactionId) throws ProtocolException { MessageId msgId = new MessageId(messageId); if (!dispatchedMessage.containsKey(msgId)) { return null; } MessageAck ack = new MessageAck(); ack.setDestination(consumerInfo.getDestination()); ack.setConsumerId(consumerInfo.getConsumerId()); ack.setAckType(MessageAck.POSION_ACK_TYPE); ack.setMessageID(msgId); if (transactionId != null) { unconsumedMessage.add(dispatchedMessage.get(msgId)); ack.setTransactionId(transactionId); } dispatchedMessage.remove(msgId); return ack; }
public MessageAck onStompMessageNack(String messageId, TransactionId transactionId) throws ProtocolException { MessageId msgId = new MessageId(messageId); if (!dispatchedMessage.containsKey(msgId)) { return null; } MessageAck ack = new MessageAck(); ack.setDestination(consumerInfo.getDestination()); ack.setConsumerId(consumerInfo.getConsumerId()); ack.setAckType(MessageAck.POSION_ACK_TYPE); ack.setMessageID(msgId); if (transactionId != null) { unconsumedMessage.add(dispatchedMessage.get(msgId)); ack.setTransactionId(transactionId); } dispatchedMessage.remove(msgId); return ack; }
public MessageAck onStompMessageNack(String messageId, TransactionId transactionId) throws ProtocolException { MessageId msgId = new MessageId(messageId); if (!dispatchedMessage.containsKey(msgId)) { return null; } MessageAck ack = new MessageAck(); ack.setDestination(consumerInfo.getDestination()); ack.setConsumerId(consumerInfo.getConsumerId()); ack.setAckType(MessageAck.POSION_ACK_TYPE); ack.setMessageID(msgId); if (transactionId != null) { unconsumedMessage.add(dispatchedMessage.get(msgId)); ack.setTransactionId(transactionId); } dispatchedMessage.remove(msgId); return ack; }
public MessageAck onStompMessageNack(String messageId, TransactionId transactionId) throws ProtocolException { MessageId msgId = new MessageId(messageId); if (!dispatchedMessage.containsKey(msgId)) { return null; } MessageAck ack = new MessageAck(); ack.setDestination(consumerInfo.getDestination()); ack.setConsumerId(consumerInfo.getConsumerId()); ack.setAckType(MessageAck.POSION_ACK_TYPE); ack.setMessageID(msgId); if (transactionId != null) { unconsumedMessage.add(dispatchedMessage.get(msgId)); ack.setTransactionId(transactionId); } dispatchedMessage.remove(msgId); return ack; }
protected void removeMessage(ConnectionContext c, Subscription subs, QueueMessageReference r) throws IOException { MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.STANDARD_ACK_TYPE); ack.setDestination(destination); ack.setMessageID(r.getMessageId()); removeMessage(c, subs, r, ack); }
protected void removeMessage(ConnectionContext c, Subscription subs, QueueMessageReference r) throws IOException { MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.STANDARD_ACK_TYPE); ack.setDestination(destination); ack.setMessageID(r.getMessageId()); removeMessage(c, subs, r, ack); }
protected void removeMessage(ConnectionContext c, Subscription subs, QueueMessageReference r) throws IOException { MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.STANDARD_ACK_TYPE); ack.setDestination(destination); ack.setMessageID(r.getMessageId()); removeMessage(c, subs, r, ack); }
protected void removeMessage(ConnectionContext c, Subscription subs, QueueMessageReference r) throws IOException { MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.STANDARD_ACK_TYPE); ack.setDestination(destination); ack.setMessageID(r.getMessageId()); removeMessage(c, subs, r, ack); }
/** * store will have a pending ack for all durables, irrespective of the * selector so we need to ack if node is un-matched */ @Override public void unmatched(MessageReference node) throws IOException { MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.UNMATCHED_ACK_TYPE); ack.setMessageID(node.getMessageId()); Destination regionDestination = (Destination) node.getRegionDestination(); regionDestination.acknowledge(this.getContext(), this, ack, node); }
/** * store will have a pending ack for all durables, irrespective of the * selector so we need to ack if node is un-matched */ @Override public void unmatched(MessageReference node) throws IOException { MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.UNMATCHED_ACK_TYPE); ack.setMessageID(node.getMessageId()); Destination regionDestination = (Destination) node.getRegionDestination(); regionDestination.acknowledge(this.getContext(), this, ack, node); }
/** * store will have a pending ack for all durables, irrespective of the * selector so we need to ack if node is un-matched */ @Override public void unmatched(MessageReference node) throws IOException { MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.UNMATCHED_ACK_TYPE); ack.setMessageID(node.getMessageId()); Destination regionDestination = (Destination) node.getRegionDestination(); regionDestination.acknowledge(this.getContext(), this, ack, node); }
/** * store will have a pending ack for all durables, irrespective of the selector * so we need to ack if node is un-matched */ public void unmatched(MessageReference node) throws IOException { MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.UNMATCHED_ACK_TYPE); ack.setMessageID(node.getMessageId()); node.getRegionDestination().acknowledge(this.getContext(), this, ack, node); }
public void messageExpired(ConnectionContext context, Subscription subs, MessageReference reference) { broker.messageExpired(context, reference, subs); // AMQ-2586: Better to leave this stat at zero than to give the user // misleading metrics. // destinationStatistics.getMessages().decrement(); destinationStatistics.getEnqueues().decrement(); destinationStatistics.getExpired().increment(); MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.STANDARD_ACK_TYPE); ack.setDestination(destination); ack.setMessageID(reference.getMessageId()); try { acknowledge(context, subs, ack, reference); } catch (IOException e) { LOG.error("Failed to remove expired Message from the store ", e); } }
public void remove(SubscriptionView view, String messageId) throws Exception { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { final Destination topic = getTopicRegion().getDestinationMap().get(destination); final MessageAck messageAck = new MessageAck(); messageAck.setMessageID(new MessageId(messageId)); messageAck.setDestination(destination); topic.getMessageStore().removeMessage(brokerService.getAdminConnectionContext(), messageAck); // if sub is active, remove from cursor if (view.subscription instanceof DurableTopicSubscription) { final DurableTopicSubscription durableTopicSubscription = (DurableTopicSubscription) view.subscription; final MessageReference messageReference = new NullMessageReference(); messageReference.getMessage().setMessageId(messageAck.getFirstMessageId()); durableTopicSubscription.getPending().remove(messageReference); } } else { throw new IllegalStateException("can't determine topic for sub:" + view); } }