Source:
<code>protected void handleMessageInternal(final Message<?> message) throws Exception { if (!this.isRunning() || !this.stompSessionManager.isConnected()) { this.running = false; this.stompSession = null; throw new MessageDeliveryException(message, "The StompMessageHandler [" + getComponentName() + "] isn't connected to StompSession. Check the state of [" + this.stompSessionManager + "]"); <START> } <END> StompHeaders stompHeaders = new StompHeaders(); this.headerMapper.fromHeaders(message.getHeaders(), stompHeaders); if (stompHeaders.getDestination() == null) { Assert.state(this.destinationExpression != null, "One of 'destination' or 'destinationExpression' must be" + " provided, if message header doesn't supply 'destination' STOMP header."); String destination = this.destinationExpression.getValue(this.evaluationContext, message, String.class); stompHeaders.setDestination(destination); } final StompSession.Receiptable receiptable = this.stompSession.send(stompHeaders, message.getPayload()); if (receiptable.getReceiptId() != null) { final String destination = stompHeaders.getDestination(); if (this.applicationEventPublisher != null) { receiptable.addReceiptTask(new Runnable() { @Override public void run() { StompReceiptEvent event = new StompReceiptEvent(StompMessageHandler.this, destination, receiptable.getReceiptId(), StompCommand.SEND, false); event.setMessage(message); applicationEventPublisher.publishEvent(event); } }); } receiptable.addReceiptLostTask(new Runnable() { @Override public void run() { if (applicationEventPublisher != null) { StompReceiptEvent event = new StompReceiptEvent(StompMessageHandler.this, destination, receiptable.getReceiptId(), StompCommand.SEND, true); event.setMessage(message); applicationEventPublisher.publishEvent(event); } else { logger.error("The receipt [" + receiptable.getReceiptId() + "] is lost for [" + message + "] on destination [" + destination + "]"); } } }); } }</code><technical_language>Right; I understand; I a bit queasy throwing exception outbound adapter connection is open yet</technical_language>

Target:
protected void handleMessageInternal(final Message<?> message) throws Exception { try { connectIfNecessary(); } catch (Exception e) { throw new MessageDeliveryException(message, "The [" + this + "] could not deliver message." , e); } StompSession stompSession = this.stompSession; StompHeaders stompHeaders = new StompHeaders(); this.headerMapper.fromHeaders(message.getHeaders(), stompHeaders); if (stompHeaders.getDestination() == null) { Assert.state(this.destinationExpression != null, "One of 'destination' or 'destinationExpression' must be" + " provided, if message header doesn't supply 'destination' STOMP header."); String destination = this.destinationExpression.getValue(this.evaluationContext, message, String.class); stompHeaders.setDestination(destination); } final StompSession.Receiptable receiptable = stompSession.send(stompHeaders, message.getPayload()); if (receiptable.getReceiptId() != null) { final String destination = stompHeaders.getDestination(); if (this.applicationEventPublisher != null) { receiptable.addReceiptTask(new Runnable() { @Override public void run() { StompReceiptEvent event = new StompReceiptEvent(StompMessageHandler.this, destination, receiptable.getReceiptId(), StompCommand.SEND, false); event.setMessage(message); applicationEventPublisher.publishEvent(event); } }); } receiptable.addReceiptLostTask(new Runnable() { @Override public void run() { if (applicationEventPublisher != null) { StompReceiptEvent event = new StompReceiptEvent(StompMessageHandler.this, destination, receiptable.getReceiptId(), StompCommand.SEND, true); event.setMessage(message); applicationEventPublisher.publishEvent(event); } else { logger.error("The receipt [" + receiptable.getReceiptId() + "] is lost for [" + message + "] on destination [" + destination + "]"); } } }); } }