@Override protected void onInit() { super.onInit(); Assert.state(!(this.sqlParameterSourceFactory != null && this.preparedStatementSetter != null), "'sqlParameterSourceFactory' and 'preparedStatementSetter' are mutually exclusive."); if (this.sqlParameterSourceFactory == null && this.preparedStatementSetter == null) { this.sqlParameterSourceFactory = new BeanPropertySqlParameterSourceFactory(); } }
/** * @param order the order. * @return the endpoint spec. * @see AbstractMessageHandler#setOrder(int) */ public S order(int order) { assertHandler(); if (this.handler instanceof AbstractMessageHandler) { ((AbstractMessageHandler) this.handler).setOrder(order); } else { this.logger.warn("'order' can be applied only for AbstractMessageHandler"); } return _this(); }
message = MessageHistory.write(message, this, getMessageBuilderFactory()); handleMessageInternal(message); if (sample != null) { sample.stop(sendTimer()); handleMessageInternal(message); sample.stop(buildSendTimer(false, e.getClass().getSimpleName()));
public final void handleMessage(Message<?> message) { Assert.notNull(message == null, "Message must not be null"); Assert.notNull(message.getPayload(), "Message payload must not be null"); if (this.logger.isDebugEnabled()) { this.logger.debug(this + " received message: " + message); } try { this.handleMessageInternal(message); } catch (Exception e) { if (e instanceof MessagingException) { throw (MessagingException) e; } throw new MessageHandlingException(message, "error occurred in message handler [" + this + "]", e); } }
private TimerFacade buildSendTimer(boolean success, String exception) { TimerFacade timer = this.metricsCaptor.timerBuilder(SEND_TIMER_NAME) .tag("type", "handler") .tag("name", getComponentName() == null ? "unknown" : getComponentName()) .tag("result", success ? "success" : "failure") .tag("exception", exception) .description("Send processing time") .build(); this.timers.add(timer); return timer; }
private TimerFacade sendTimer() { if (this.successTimer == null) { this.successTimer = buildSendTimer(true, "none"); } return this.successTimer; }
private TimerFacade buildSendTimer(boolean success, String exception) { TimerFacade timer = this.metricsCaptor.timerBuilder(SEND_TIMER_NAME) .tag("type", "handler") .tag("name", getComponentName() == null ? "unknown" : getComponentName()) .tag("result", success ? "success" : "failure") .tag("exception", exception) .description("Send processing time") .build(); this.timers.add(timer); return timer; }
private TimerFacade sendTimer() { if (this.successTimer == null) { this.successTimer = buildSendTimer(true, "none"); } return this.successTimer; }
@Override protected void onInit() { super.onInit(); if (this.isClientMode) { Assert.notNull(this.clientConnectionFactory, "For client-mode, connection factory must be type='client'"); Assert.isTrue(!this.clientConnectionFactory.isSingleUse(), "For client-mode, connection factory must have single-use='false'"); } }
message = MessageHistory.write(message, this, getMessageBuilderFactory()); handleMessageInternal(message); if (sample != null) { sample.stop(sendTimer()); handleMessageInternal(message); sample.stop(buildSendTimer(false, e.getClass().getSimpleName()));
/** * @param order the order. * @return the endpoint spec. * @see AbstractMessageHandler#setOrder(int) */ public S order(int order) { assertHandler(); if (this.handler instanceof AbstractMessageHandler) { ((AbstractMessageHandler) this.handler).setOrder(order); } else { this.logger.warn("'order' can be applied only for AbstractMessageHandler"); } return _this(); }
@Override protected void onInit() { super.onInit(); if (!CollectionUtils.isEmpty(this.messageConverters)) { List<MessageConverter> converters = this.messageConverter.getConverters(); if (this.mergeWithDefaultConverters) { ListIterator<MessageConverter> iterator = this.messageConverters.listIterator(this.messageConverters.size()); while (iterator.hasPrevious()) { MessageConverter converter = iterator.previous(); converters.add(0, converter); } } else { converters.clear(); converters.addAll(this.messageConverters); } } }
/** * @param order the order. * @return the endpoint spec. * @see AbstractMessageHandler#setOrder(int) */ public S order(int order) { assertHandler(); if (this.handler instanceof AbstractMessageHandler) { ((AbstractMessageHandler) this.handler).setOrder(order); } else { logger.warn("'order' can be applied only for AbstractMessageHandler"); } return _this(); }
@Override protected void onInit() { super.onInit(); if (this.evaluationContext == null) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } }
/** * @param order the order. * @return the endpoint spec. * @see AbstractMessageHandler#setOrder(int) */ public S order(int order) { assertHandler(); if (this.handler instanceof AbstractMessageHandler) { ((AbstractMessageHandler) this.handler).setOrder(order); } else { logger.warn("'order' can be applied only for AbstractMessageHandler"); } return _this(); }
@Override protected void onInit() { super.onInit(); this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); }
public Object getObject() throws Exception { if (this.handler == null) { this.initializeHandler(); Assert.notNull(this.handler, "failed to create MessageHandler"); if (this.handler instanceof AbstractReplyProducingMessageHandler && this.outputChannel != null) { ((AbstractReplyProducingMessageHandler) this.handler).setOutputChannel(this.outputChannel); } if (this.handler instanceof BeanFactoryAware) { ((BeanFactoryAware) this.handler).setBeanFactory(beanFactory); } if (this.handler instanceof AbstractMessageHandler && this.order != null) { ((AbstractMessageHandler) this.handler).setOrder(this.order.intValue()); } } return this.handler; }
@Override protected void onInit() { super.onInit(); if (this.evaluationContext == null) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } }
public Object postProcess(Object bean, String beanName, Method method, T annotation) { MessageHandler handler = this.createHandler(bean, method, annotation); if (handler instanceof AbstractMessageHandler) { Order orderAnnotation = AnnotationUtils.findAnnotation(method, Order.class); if (orderAnnotation != null) { ((AbstractMessageHandler) handler).setOrder(orderAnnotation.value()); } } if (beanFactory instanceof ConfigurableListableBeanFactory) { handler = (MessageHandler) ((ConfigurableListableBeanFactory) beanFactory).initializeBean(handler, "_initHandlerFor_" + beanName); } AbstractEndpoint endpoint = this.createEndpoint(handler, annotation); if (endpoint != null) { return endpoint; } return handler; }
@Override protected void onInit() { super.onInit(); Assert.state(!(this.defaultOutputChannelName != null && this.defaultOutputChannel != null), "'defaultOutputChannelName' and 'defaultOutputChannel' are mutually exclusive."); if (this.getBeanFactory() != null) { this.messagingTemplate.setBeanFactory(this.getBeanFactory()); } }