All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ar4k.agent.hazelcast.InternalMessageHandler Maven / Gradle / Ivy

package org.ar4k.agent.hazelcast;

import org.ar4k.agent.core.data.AbstractChannel;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;

import com.hazelcast.core.ITopic;

public class InternalMessageHandler implements MessageHandler {

  private ITopic target = null;
  private AbstractChannel source = null;

  public InternalMessageHandler(AbstractChannel source, ITopic target) {
    this.target = target;
    this.source = source;
  }

  @Override
  public void handleMessage(Message message) throws MessagingException {
    target.publish(message.getPayload());
  }

  public ITopic getTarget() {
    return target;
  }

  public void setTarget(ITopic target) {
    this.target = target;
  }

  public AbstractChannel getSource() {
    return source;
  }

  public void setSource(AbstractChannel source) {
    this.source = source;
  }

}