@Override public final boolean send(Message<?> message, long timeout) { Assert.notNull(message, "Message must not be null"); Message<?> messageToUse = message; ChannelInterceptorChain chain = new ChannelInterceptorChain(); boolean sent = false; try { messageToUse = chain.applyPreSend(messageToUse, this); if (messageToUse == null) { return false; } sent = sendInternal(messageToUse, timeout); chain.applyPostSend(messageToUse, this, sent); chain.triggerAfterSendCompletion(messageToUse, this, sent, null); return sent; } catch (Exception ex) { chain.triggerAfterSendCompletion(messageToUse, this, sent, ex); if (ex instanceof MessagingException) { throw (MessagingException) ex; } throw new MessageDeliveryException(messageToUse,"Failed to send message to " + this, ex); } catch (Throwable err) { MessageDeliveryException ex2 = new MessageDeliveryException(messageToUse, "Failed to send message to " + this, err); chain.triggerAfterSendCompletion(messageToUse, this, sent, ex2); throw ex2; } }
@Override public final boolean send(Message<?> message, long timeout) { Assert.notNull(message, "Message must not be null"); Message<?> messageToUse = message; ChannelInterceptorChain chain = new ChannelInterceptorChain(); boolean sent = false; try { messageToUse = chain.applyPreSend(messageToUse, this); if (messageToUse == null) { return false; } sent = sendInternal(messageToUse, timeout); chain.applyPostSend(messageToUse, this, sent); chain.triggerAfterSendCompletion(messageToUse, this, sent, null); return sent; } catch (Exception ex) { chain.triggerAfterSendCompletion(messageToUse, this, sent, ex); if (ex instanceof MessagingException) { throw (MessagingException) ex; } throw new MessageDeliveryException(messageToUse,"Failed to send message to " + this, ex); } catch (Throwable err) { MessageDeliveryException ex2 = new MessageDeliveryException(messageToUse, "Failed to send message to " + this, err); chain.triggerAfterSendCompletion(messageToUse, this, sent, ex2); throw ex2; } }
@Override public final boolean send(Message<?> message, long timeout) { Assert.notNull(message, "Message must not be null"); Message<?> messageToUse = message; ChannelInterceptorChain chain = new ChannelInterceptorChain(); boolean sent = false; try { messageToUse = chain.applyPreSend(messageToUse, this); if (messageToUse == null) { return false; } sent = sendInternal(messageToUse, timeout); chain.applyPostSend(messageToUse, this, sent); chain.triggerAfterSendCompletion(messageToUse, this, sent, null); return sent; } catch (Exception ex) { chain.triggerAfterSendCompletion(messageToUse, this, sent, ex); if (ex instanceof MessagingException) { throw (MessagingException) ex; } throw new MessageDeliveryException(messageToUse,"Failed to send message to " + this, ex); } catch (Throwable err) { MessageDeliveryException ex2 = new MessageDeliveryException(messageToUse, "Failed to send message to " + this, err); chain.triggerAfterSendCompletion(messageToUse, this, sent, ex2); throw ex2; } }
@Nullable public Message<?> applyPreSend(Message<?> message, MessageChannel channel) { Message<?> messageToUse = message; for (ChannelInterceptor interceptor : interceptors) { Message<?> resolvedMessage = interceptor.preSend(messageToUse, channel); if (resolvedMessage == null) { String name = interceptor.getClass().getSimpleName(); if (logger.isDebugEnabled()) { logger.debug(name + " returned null from preSend, i.e. precluding the send."); } triggerAfterSendCompletion(messageToUse, channel, false, null); return null; } messageToUse = resolvedMessage; this.sendInterceptorIndex++; } return messageToUse; }
@Nullable public Message<?> applyPreSend(Message<?> message, MessageChannel channel) { Message<?> messageToUse = message; for (ChannelInterceptor interceptor : interceptors) { Message<?> resolvedMessage = interceptor.preSend(messageToUse, channel); if (resolvedMessage == null) { String name = interceptor.getClass().getSimpleName(); if (logger.isDebugEnabled()) { logger.debug(name + " returned null from preSend, i.e. precluding the send."); } triggerAfterSendCompletion(messageToUse, channel, false, null); return null; } messageToUse = resolvedMessage; this.sendInterceptorIndex++; } return messageToUse; }
public boolean applyPreReceive(MessageChannel channel) { for (ChannelInterceptor interceptor : interceptors) { if (!interceptor.preReceive(channel)) { triggerAfterReceiveCompletion(null, channel, null); return false; } this.receiveInterceptorIndex++; } return true; }
public boolean applyPreReceive(MessageChannel channel) { for (ChannelInterceptor interceptor : interceptors) { if (!interceptor.preReceive(channel)) { triggerAfterReceiveCompletion(null, channel, null); return false; } this.receiveInterceptorIndex++; } return true; }
@Override public final boolean send(Message<?> message, long timeout) { Assert.notNull(message, "Message must not be null"); Message<?> messageToUse = message; ChannelInterceptorChain chain = new ChannelInterceptorChain(); boolean sent = false; try { messageToUse = chain.applyPreSend(messageToUse, this); if (messageToUse == null) { return false; } sent = sendInternal(messageToUse, timeout); chain.applyPostSend(messageToUse, this, sent); chain.triggerAfterSendCompletion(messageToUse, this, sent, null); return sent; } catch (Exception ex) { chain.triggerAfterSendCompletion(messageToUse, this, sent, ex); if (ex instanceof MessagingException) { throw (MessagingException) ex; } throw new MessageDeliveryException(messageToUse,"Failed to send message to " + this, ex); } catch (Throwable err) { MessageDeliveryException ex2 = new MessageDeliveryException(messageToUse, "Failed to send message to " + this, err); chain.triggerAfterSendCompletion(messageToUse, this, sent, ex2); throw ex2; } }
@Nullable public Message<?> applyPreSend(Message<?> message, MessageChannel channel) { Message<?> messageToUse = message; for (ChannelInterceptor interceptor : interceptors) { Message<?> resolvedMessage = interceptor.preSend(messageToUse, channel); if (resolvedMessage == null) { String name = interceptor.getClass().getSimpleName(); if (logger.isDebugEnabled()) { logger.debug(name + " returned null from preSend, i.e. precluding the send."); } triggerAfterSendCompletion(messageToUse, channel, false, null); return null; } messageToUse = resolvedMessage; this.sendInterceptorIndex++; } return messageToUse; }
public boolean applyPreReceive(MessageChannel channel) { for (ChannelInterceptor interceptor : interceptors) { if (!interceptor.preReceive(channel)) { triggerAfterReceiveCompletion(null, channel, null); return false; } this.receiveInterceptorIndex++; } return true; }
@Nullable public Message<?> applyPreSend(Message<?> message, MessageChannel channel) { Message<?> messageToUse = message; for (ChannelInterceptor interceptor : interceptors) { Message<?> resolvedMessage = interceptor.preSend(messageToUse, channel); if (resolvedMessage == null) { String name = interceptor.getClass().getSimpleName(); if (logger.isDebugEnabled()) { logger.debug(name + " returned null from preSend, i.e. precluding the send."); } triggerAfterSendCompletion(messageToUse, channel, false, null); return null; } messageToUse = resolvedMessage; this.sendInterceptorIndex++; } return messageToUse; }
public boolean applyPreReceive(MessageChannel channel) { for (ChannelInterceptor interceptor : interceptors) { if (!interceptor.preReceive(channel)) { triggerAfterReceiveCompletion(null, channel, null); return false; } this.receiveInterceptorIndex++; } return true; }