Example usage for org.springframework.integration.jmx JmxHeaders NOTIFICATION_HANDBACK

List of usage examples for org.springframework.integration.jmx JmxHeaders NOTIFICATION_HANDBACK

Introduction

In this page you can find the example usage for org.springframework.integration.jmx JmxHeaders NOTIFICATION_HANDBACK.

Prototype

String NOTIFICATION_HANDBACK

To view the source code for org.springframework.integration.jmx JmxHeaders NOTIFICATION_HANDBACK.

Click Source Link

Usage

From source file:org.springframework.integration.jmx.NotificationListeningMessageProducer.java

/**
 * Notification handling method implementation. Creates a Message with the
 * JMX {@link Notification} as its payload, and if the handback object is
 * not null, it sets that as a Message header value. The Message is then
 * sent to this producer's output channel.
 */// w  ww  .  j a  v  a 2  s  .c o m
public void handleNotification(Notification notification, Object handback) {
    if (logger.isInfoEnabled()) {
        logger.info("received notification: " + notification + ", and handback: " + handback);
    }
    MessageBuilder<?> builder = MessageBuilder.withPayload(notification);
    if (handback != null) {
        builder.setHeader(JmxHeaders.NOTIFICATION_HANDBACK, handback);
    }
    Message<?> message = builder.build();
    this.sendMessage(message);
}