/** @param packet */ private void handlePageWrite(final ReplicationPageWriteMessage packet) throws Exception { PagedMessage pgdMessage = packet.getPagedMessage(); pgdMessage.initMessage(storageManager); ServerMessage msg = pgdMessage.getMessage(); Page page = getPage(msg.getAddress(), packet.getPageNumber()); page.write(pgdMessage); }
@Override public HandleStatus handle(final MessageReference ref) throws Exception { if (filter != null && !filter.match(ref.getMessage())) { return HandleStatus.NO_MATCH; } synchronized (this) { if (!active || !session.isWritable(this)) { if (logger.isDebugEnabled()) { logger.debug(this + "::Ignoring reference on bridge as it is set to inactive ref=" + ref); } return HandleStatus.BUSY; } if (deliveringLargeMessage) { return HandleStatus.BUSY; } if (logger.isTraceEnabled()) { logger.trace("Bridge " + this + " is handling reference=" + ref); } ref.handled(); synchronized (refs) { refs.put(ref.getMessage().getMessageID(), ref); } final ServerMessage message = beforeForward(ref.getMessage()); final SimpleString dest; if (forwardingAddress != null) { dest = forwardingAddress; } else { // Preserve the original address dest = message.getAddress(); } pendingAcks.countUp(); try { if (message.isLargeMessage()) { deliveringLargeMessage = true; deliverLargeMessage(dest, ref, (LargeServerMessage) message); return HandleStatus.HANDLED; } else { return deliverStandardMessage(dest, ref, message); } } catch (Exception e) { // If an exception happened, we must count down immediately pendingAcks.countDown(); throw e; } } }
/** * We convert the core address to an ActiveMQ Destination. We use the actual address on the * message rather than the destination set on the consumer because it maybe different and the JMS * spec says that it should be what ever was set on publish/send so a divert or wildcard may mean * thats its different to the destination subscribed to by the consumer */ public static ActiveMQDestination toAMQAddress( ServerMessage message, ActiveMQDestination actualDestination) { String address = message.getAddress().toString(); String strippedAddress = address .replace(JMS_QUEUE_ADDRESS_PREFIX, "") .replace(JMS_TEMP_QUEUE_ADDRESS_PREFIX, "") .replace(JMS_TOPIC_ADDRESS_PREFIX, "") .replace(JMS_TEMP_TOPIC_ADDRESS_PREFIX, ""); if (actualDestination.isQueue()) { return new ActiveMQQueue(strippedAddress); } else { return new ActiveMQTopic(strippedAddress); } }