@Override protected boolean doSend(Message<?> message, long timeout) { try { return getRequiredDispatcher().dispatch(message); } catch (MessageDispatchingException e) { String description = e.getMessage() + " for channel '" + this.getFullChannelName() + "'."; throw new MessageDeliveryException(message, description, e); } }
@Override public boolean subscribe(MessageHandler handler) { MessageDispatcher dispatcher = getRequiredDispatcher(); boolean added = dispatcher.addHandler(handler); adjustCounterIfNecessary(dispatcher, added ? 1 : 0); return added; }
@Override public boolean unsubscribe(MessageHandler handle) { MessageDispatcher dispatcher = getRequiredDispatcher(); boolean removed = dispatcher.removeHandler(handle); this.adjustCounterIfNecessary(dispatcher, removed ? -1 : 0); return removed; }
private void adjustCounterIfNecessary(MessageDispatcher dispatcher, int delta) { if (delta != 0) { if (logger.isInfoEnabled()) { logger.info("Channel '" + this.getFullChannelName() + "' has " + dispatcher.getHandlerCount() + " subscriber(s)."); } } }
@Override public int getSubscriberCount() { return getRequiredDispatcher().getHandlerCount(); }
@Override public void onMessage(org.springframework.amqp.core.Message message) { Message<?> messageToSend = null; try { Object converted = this.converter.fromMessage(message); messageToSend = (converted instanceof Message<?>) ? (Message<?>) converted : buildMessage(message, converted); this.dispatcher.dispatch(messageToSend); } catch (MessageDispatchingException e) { String exceptionMessage = e.getMessage() + " for amqp-channel '" + this.channel.getFullChannelName() + "'."; if (this.isPubSub) { // log only for backwards compatibility with pub/sub if (this.logger.isWarnEnabled()) { this.logger.warn(exceptionMessage, e); } } else { throw new MessageDeliveryException(messageToSend, exceptionMessage, e); } } }
public boolean unsubscribe(MessageHandler handle) { return this.getRequiredDispatcher().removeHandler(handle); }
public boolean subscribe(MessageHandler handler) { return this.getRequiredDispatcher().addHandler(handler); }
private void adjustCounterIfNecessary(MessageDispatcher dispatcher, int delta) { if (delta != 0) { if (logger.isInfoEnabled()) { logger.info("Channel '" + this.getFullChannelName() + "' has " + dispatcher.getHandlerCount() + " subscriber(s)."); } } }
messageToSend = (converted instanceof Message<?>) ? (Message<?>) converted : this.messageBuilderFactory.withPayload(converted).build(); this.dispatcher.dispatch(messageToSend);
@Override public boolean unsubscribe(MessageHandler handle) { MessageDispatcher dispatcher = getRequiredDispatcher(); boolean removed = dispatcher.removeHandler(handle); this.adjustCounterIfNecessary(dispatcher, removed ? -1 : 0); return removed; }
@Override public boolean subscribe(MessageHandler handler) { MessageDispatcher dispatcher = getRequiredDispatcher(); boolean added = dispatcher.addHandler(handler); adjustCounterIfNecessary(dispatcher, added ? 1 : 0); return added; }
@Override public int getSubscriberCount() { return getRequiredDispatcher().getHandlerCount(); }
@Override protected boolean doSend(Message<?> message, long timeout) { return this.getRequiredDispatcher().dispatch(message); }
@Override protected boolean doSend(Message<?> message, long timeout) { try { return getRequiredDispatcher().dispatch(message); } catch (MessageDispatchingException e) { String description = e.getMessage() + " for channel '" + this.getFullChannelName() + "'."; throw new MessageDeliveryException(message, description, e); } }
@Override public void onMessage(org.springframework.amqp.core.Message message) { Message<?> messageToSend = null; try { Object converted = this.converter.fromMessage(message); messageToSend = (converted instanceof Message<?>) ? (Message<?>) converted : buildMessage(message, converted); this.dispatcher.dispatch(messageToSend); } catch (MessageDispatchingException e) { String exceptionMessage = e.getMessage() + " for amqp-channel '" + this.channel.getFullChannelName() + "'."; if (this.isPubSub) { // log only for backwards compatibility with pub/sub if (this.logger.isWarnEnabled()) { this.logger.warn(exceptionMessage, e); } } else { throw new MessageDeliveryException(messageToSend, exceptionMessage, e); } } }
messageToSend = (converted instanceof Message<?>) ? (Message<?>) converted : this.messageBuilderFactory.withPayload(converted).build(); this.dispatcher.dispatch(messageToSend);