/** * Clears out the message body. Clearing a message's body does not clear its header values or * property entries. * * <p>If this message body was read-only, calling this method leaves the message body in the same * state as an empty body in a newly created message. * * @throws JMSException if the JMS provider fails to clear the message body due to some internal * error. */ @Override public void clearBody() throws JMSException { super.clearBody(); this.dataOut = null; this.dataIn = null; this.bytesOut = null; }
private void copy(ActiveMQBytesMessage copy) { storeContent(); super.copy(copy); copy.dataOut = null; copy.bytesOut = null; copy.dataIn = null; }
/** In this method we apply the JMS acknowledgement and redelivery semantics as per JMS spec */ @Override public void onMessage(final ClientMessage message) { ActiveMQMessage msg = ActiveMQMessage.createMessage(message, session.getCoreSession()); if (individualACK) { msg.setIndividualAcknowledge(); } try { msg.doBeforeReceive(); } catch (Exception e) { ActiveMQJMSClientLogger.LOGGER.errorPreparingMessageForReceipt( msg.getCoreMessage().toString(), e); return; } if (transactedOrClientAck) { try { message.acknowledge(); } catch (ActiveMQException e) { ((ClientSessionInternal) session.getCoreSession()).markRollbackOnly(); ActiveMQJMSClientLogger.LOGGER.errorProcessingMessage(e); } } try { connection.getThreadAwareContext().setCurrentThread(false); listener.onMessage(msg); } catch (RuntimeException e) { // See JMS 1.1 spec, section 4.5.2 ActiveMQJMSClientLogger.LOGGER.onMessageError(e); if (!transactedOrClientAck) { try { if (individualACK) { message.individualAcknowledge(); } session.getCoreSession().rollback(true); session.setRecoverCalled(true); } catch (Exception e2) { ActiveMQJMSClientLogger.LOGGER.errorRecoveringSession(e2); } } } finally { connection.getThreadAwareContext().clearCurrentThread(false); } if (!session.isRecoverCalled() && !individualACK) { try { // We don't want to call this if the consumer was closed from inside onMessage if (!consumer.isClosed() && !transactedOrClientAck) { message.acknowledge(); } } catch (ActiveMQException e) { ((ClientSessionInternal) session.getCoreSession()).markRollbackOnly(); ActiveMQJMSClientLogger.LOGGER.errorProcessingMessage(e); } } session.setRecoverCalled(false); }
@Override public void setObjectProperty(String name, Object value) throws JMSException { initializeWriting(); super.setObjectProperty(name, value); }
@Override public void onSend() throws JMSException { super.onSend(); storeContent(); }