public TopicMessageStore createTopicMessageStore(ActiveMQTopic destinationName) throws IOException { AMQTopicMessageStore store = topics.get(destinationName); if (store == null) { TopicReferenceStore checkpointStore = referenceStoreAdapter.createTopicReferenceStore(destinationName); store = new AMQTopicMessageStore(this,checkpointStore, destinationName); try { store.start(); } catch (Exception e) { throw IOExceptionSupport.create(e); } topics.put(destinationName, store); } return store; }
public void afterCommit() throws Exception { if (debug) { LOG.debug("Transacted acknowledge commit for: " + messageId + ", at: " + location); } lock.lock(); try { inFlightTxLocations.remove(location); acknowledge(context,messageId, location, clientId,subscriptionName); }finally { lock.unlock(); } }
public int getMessageCount(String clientId, String subscriberName) throws IOException { flush(); SubscriptionInfo info = lookupSubscription(clientId, subscriberName); try { MessageCounter counter = new MessageCounter(info, this); topicReferenceStore.recoverSubscription(clientId, subscriberName, counter); return counter.count; } catch (Exception e) { throw IOExceptionSupport.create(e); } }
public void recoverSubscription(String clientId, String subscriptionName, MessageRecoveryListener listener) throws Exception { flush(); topicReferenceStore.recoverSubscription(clientId, subscriptionName, new RecoveryListenerAdapter(this, listener)); }
public boolean replay(AMQPersistenceAdapter adapter, ConnectionContext context) throws IOException { boolean result = false; AMQMessageStore store = (AMQMessageStore)adapter.createMessageStore(destination); if (operationType == ADD_OPERATION_TYPE) { result = store.replayAddMessage(context, (Message)data, location); } else if (operationType == REMOVE_OPERATION_TYPE) { result = store.replayRemoveMessage(context, (MessageAck)data); } else { JournalTopicAck ack = (JournalTopicAck)data; result = ((AMQTopicMessageStore)store).replayAcknowledge(context, ack.getClientId(), ack .getSubscritionName(), ack.getMessageId()); } return result; }
public void add(AMQTopicMessageStore store, JournalTopicAck ack) { operations.add(new AMQTxOperation(AMQTxOperation.ACK_OPERATION_TYPE, store.getDestination(), ack, null)); }
while (topicIterator.hasNext()) { final AMQTopicMessageStore ms = topicIterator.next(); Location mark = ms.getMark(); if (mark != null && (newMark == null || mark.compareTo(newMark) > 0)) { newMark = mark;
/** * @param messageId * @param location * @param key * @throws IOException */ protected void acknowledge(final ConnectionContext context, MessageId messageId, Location location, String clientId, String subscriptionName) throws IOException { MessageAck ack = null; lock.lock(); try { lastLocation = location; }finally { lock.unlock(); } if (topicReferenceStore.acknowledgeReference(context, clientId, subscriptionName, messageId)) { ack = new MessageAck(); ack.setLastMessageId(messageId); } if (ack != null) { removeMessage(context, ack); } }
while (topicIterator.hasNext()) { final AMQTopicMessageStore ms = topicIterator.next(); ms.stop();
public void recoverNextMessages(String clientId, String subscriptionName, int maxReturned, final MessageRecoveryListener listener) throws Exception { RecoveryListenerAdapter recoveryListener = new RecoveryListenerAdapter(this, listener); topicReferenceStore.recoverNextMessages(clientId, subscriptionName,maxReturned, recoveryListener); if (recoveryListener.size() == 0) { flush(); topicReferenceStore.recoverNextMessages(clientId,subscriptionName, maxReturned, recoveryListener); } }
transactionStore.acknowledge(store, command, pos); } else { if (store.replayAcknowledge(context, command.getClientId(), command.getSubscritionName(), command.getMessageId())) { redoCounter++;
LOG.debug("Journalled acknowledge for: " + messageId + ", at: " + location); acknowledge(context,messageId, location, clientId,subscriptionName); } else { if (debug) {