@Nullable public Message<?> receive(long timeout) { ChannelInterceptorList interceptorList = getInterceptors(); Deque<ChannelInterceptor> interceptorStack = null; boolean counted = false; boolean countsEnabled = isCountsEnabled(); try { if (isLoggingEnabled() && logger.isTraceEnabled()) { logger.trace("preReceive on channel '" + this + "'"); Message<?> message = doReceive(timeout); if (message == null) { if (isLoggingEnabled() && logger.isTraceEnabled()) { logger.trace("postReceive on channel '" + this + "', message is null"); if (getMetricsCaptor() != null) { incrementReceiveCounter(); getMetrics().afterReceive(); counted = true; if (isLoggingEnabled() && logger.isDebugEnabled()) { logger.debug("postReceive on channel '" + this + "', message: " + message); if (getMetricsCaptor() != null) { CounterFacade counter = getMetricsCaptor().counterBuilder(RECEIVE_COUNTER_NAME) .tag("name", getComponentName() == null ? "unknown" : getComponentName()) .tag("type", "channel") .tag("result", "failure")
/** * Receive the first available message from this channel. If the channel * contains no messages, this method will block. * * @return the first available message or <code>null</code> if the * receiving thread is interrupted. */ @Override @Nullable public Message<?> receive() { return receive(-1); }
/** * Receive the first available message from this channel. If the channel * contains no messages, this method will block until the allotted timeout * elapses. If the specified timeout is 0, the method will return * immediately. If less than zero, it will block indefinitely (see * {@link #receive()}). * * @param timeout the timeout in milliseconds * * @return the first available message or <code>null</code> if no message * is available within the allotted time or the receiving thread is * interrupted. */ public final Message<?> receive(long timeout) { if (!this.getInterceptors().preReceive(this)) { return null; } Message<?> message = this.doReceive(timeout); message = this.getInterceptors().postReceive(message, this); return message; }
private void incrementReceiveCounter() { if (this.receiveCounter == null) { this.receiveCounter = getMetricsCaptor().counterBuilder(RECEIVE_COUNTER_NAME) .tag("name", getComponentName()) .tag("type", "channel") .tag("result", "success") .tag("exception", "none") .description("Messages received") .build(); } this.receiveCounter.increment(); }
@Override public int getReceiveCount() { return getMetrics().getReceiveCount(); }
private void incrementReceiveCounter() { if (this.receiveCounter == null) { this.receiveCounter = getMetricsCaptor().counterBuilder(RECEIVE_COUNTER_NAME) .tag("name", getComponentName()) .tag("type", "channel") .tag("result", "success") .tag("exception", "none") .description("Messages received") .build(); } this.receiveCounter.increment(); }
@Override public int getReceiveErrorCount() { return getMetrics().getReceiveErrorCount(); }
@Nullable public Message<?> receive(long timeout) { ChannelInterceptorList interceptorList = getInterceptors(); Deque<ChannelInterceptor> interceptorStack = null; boolean counted = false; boolean countsEnabled = isCountsEnabled(); try { if (isLoggingEnabled() && logger.isTraceEnabled()) { logger.trace("preReceive on channel '" + this + "'"); Message<?> message = doReceive(timeout); if (message == null) { if (isLoggingEnabled() && logger.isTraceEnabled()) { logger.trace("postReceive on channel '" + this + "', message is null"); if (getMetricsCaptor() != null) { incrementReceiveCounter(); getMetrics().afterReceive(); counted = true; if (isLoggingEnabled() && logger.isDebugEnabled()) { logger.debug("postReceive on channel '" + this + "', message: " + message); if (getMetricsCaptor() != null) { CounterFacade counter = getMetricsCaptor().counterBuilder(RECEIVE_COUNTER_NAME) .tag("name", getComponentName() == null ? "unknown" : getComponentName()) .tag("type", "channel") .tag("result", "failure")
@Override public long getReceiveCountLong() { return getMetrics().getReceiveCountLong(); }
/** * Receive the first available message from this channel. If the channel * contains no messages, this method will block. * * @return the first available message or <code>null</code> if the * receiving thread is interrupted. */ public final Message<?> receive() { return this.receive(-1); }
@Override public long getReceiveErrorCountLong() { return getMetrics().getReceiveErrorCountLong(); }
/** * Receive the first available message from this channel. If the channel * contains no messages, this method will block. * * @return the first available message or <code>null</code> if the * receiving thread is interrupted. */ @Override @Nullable public Message<?> receive() { return receive(-1); }
@Override public long getReceiveCountLong() { return getMetrics().getReceiveCountLong(); }
@Override public long getReceiveErrorCountLong() { return getMetrics().getReceiveErrorCountLong(); }
@Override public int getReceiveCount() { return getMetrics().getReceiveCount(); }
@Override public int getReceiveErrorCount() { return getMetrics().getReceiveErrorCount(); }