public void route(final ServerMessage message, final RoutingContext context) throws Exception { // We must make a copy of the message, otherwise things like returning credits to the page won't // work // properly on ack, since the original address will be overwritten // TODO we can optimise this so it doesn't copy if it's not routed anywhere else if (HornetQServerLogger.LOGGER.isTraceEnabled()) { HornetQServerLogger.LOGGER.trace("Diverting message " + message + " into " + this); } long id = storageManager.generateUniqueID(); ServerMessage copy = message.copy(id); copy.finishCopy(); // This will set the original MessageId, and the original address copy.setOriginalHeaders(message, null, false); copy.setAddress(forwardAddress); if (transformer != null) { copy = transformer.transform(copy); } postOffice.route(copy, context.getTransaction(), false); }
private void doSend(final ServerMessage msg, final boolean direct) throws Exception { // check the user has write access to this address. try { securityStore.check(msg.getAddress(), CheckType.SEND, this); } catch (HornetQException e) { if (!autoCommitSends) { tx.markAsRollbackOnly(e); } throw e; } if (tx == null || autoCommitSends) { } else { routingContext.setTransaction(tx); } postOffice.route(msg, routingContext, direct); Pair<UUID, AtomicLong> value = targetAddressInfos.get(msg.getAddress()); if (value == null) { targetAddressInfos.put( msg.getAddress(), new Pair<UUID, AtomicLong>(msg.getUserID(), new AtomicLong(1))); } else { value.setA(msg.getUserID()); value.getB().incrementAndGet(); } routingContext.clear(); }