public void sendContinuations( final int packetSize, final long messageBodySize, final byte[] body, final boolean continues) throws Exception { if (currentLargeMessage == null) { throw HornetQMessageBundle.BUNDLE.largeMessageNotInitialised(); } // Immediately release the credits for the continuations- these don't contribute to the // in-memory size // of the message currentLargeMessage.addBytes(body); if (!continues) { currentLargeMessage.releaseResources(); if (messageBodySize >= 0) { currentLargeMessage.putLongProperty(Message.HDR_LARGE_BODY_SIZE, messageBodySize); } doSend(currentLargeMessage, false); currentLargeMessage = null; } }
public void send(final ServerMessage message, final boolean direct) throws Exception { // large message may come from StompSession directly, in which // case the id header already generated. if (!message.isLargeMessage()) { long id = storageManager.generateUniqueID(); message.setMessageID(id); message.encodeMessageIDToBuffer(); } SimpleString address = message.getAddress(); if (defaultAddress == null && address != null) { defaultAddress = address; } if (address == null) { if (message.isDurable()) { // We need to force a re-encode when the message gets persisted or when it gets reloaded // it will have no address message.setAddress(defaultAddress); } else { // We don't want to force a re-encode when the message gets sent to the consumer message.setAddressTransient(defaultAddress); } } if (isTrace) { HornetQServerLogger.LOGGER.trace( "send(message=" + message + ", direct=" + direct + ") being called"); } if (message.getAddress() == null) { // This could happen with some tests that are ignoring messages throw HornetQMessageBundle.BUNDLE.noAddress(); } if (message.getAddress().equals(managementAddress)) { // It's a management message handleManagementMessage(message, direct); } else { doSend(message, direct); } }
private void handleManagementMessage(final ServerMessage message, final boolean direct) throws Exception { try { securityStore.check(message.getAddress(), CheckType.MANAGE, this); } catch (HornetQException e) { if (!autoCommitSends) { tx.markAsRollbackOnly(e); } throw e; } ServerMessage reply = managementService.handleMessage(message); SimpleString replyTo = message.getSimpleStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME); if (replyTo != null) { reply.setAddress(replyTo); doSend(reply, direct); } }